Skip to content

Commit

Permalink
Merge pull request #12 from rrigato/dev
Browse files Browse the repository at this point in the history
about and projects button
  • Loading branch information
rrigato authored Nov 12, 2023
2 parents 3080c27 + 128ddc1 commit 9f8ba1e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ body, html {
.toggle-container{
align-items: center;
display: flex;
justify-content: center;
height: 80%;
justify-content: center;
}


42 changes: 40 additions & 2 deletions static/js/HomePageToggle.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
import React from 'react';
import {useState} from 'react';
import '../css/main.css';

export function HomePageToggle(){
/**
* @type {[Number, Function]}
*/
const [selectedSection, setSelectedSelection] = useState(0);
return(
<div id='home-page-toggle-component' className='full-height'>
<div className='toggle-container'>
<button>Projects</button>
<button
onClick={
() => {
setSelectedSelection(0);
}
}
>
Projects
</button>

<button
onClick={
() => {
setSelectedSelection(1)
}
}
>
About
</button>

<button
onClick={
() => {
setSelectedSelection(2)
}
}
>
Blog
</button>

<br/>
<div id='toggle-0'>
<div
id='toggle-0'
hidden= {
selectedSection !== 0
}>
Latest Projects
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions static/tests/HomePageToggle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ describe('Central Content for site', () => {
const {getByRole} = render(<HomePageToggle/>);


const aboutButton = await getByRole(
'button', {name: 'About'}
);
const projectButton = await getByRole(
'button', {name: 'Projects'}
);


});
});

0 comments on commit 9f8ba1e

Please sign in to comment.