-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work page #29
Merged
Work page #29
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fb7871a
Merge branch 'main' into work-page
nicholeuf 2dd85e2
Merge branch 'main' into work-page
nicholeuf ef956db
Merge branch 'main' into work-page
nicholeuf 6d9488c
Saving progress on work page
nicholeuf e6b01f8
save more progress
nicholeuf 5832f72
fix build issue
nicholeuf 24da592
copy change
nicholeuf 126a462
change copy
nicholeuf dcc6f81
add vertical padding
nicholeuf cb589c8
write some test for work page
nicholeuf e52eac1
copy changes
nicholeuf 5bd4b52
write testing notes
nicholeuf dcbbffd
Use selectionFollowsFocus rather than manually handling the onKeyDown…
nicholeuf 4feea6e
commit partial test
nicholeuf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import List, { ListProps } from '@mui/material/List'; | ||
|
||
interface ChipListProps extends ListProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const ChipList: React.FC<ChipListProps> = ({ children, ...props }) => { | ||
return ( | ||
<List | ||
{...props} | ||
data-testid="chip-list" | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
alignItems: 'center', | ||
flexWrap: 'wrap', | ||
}} | ||
> | ||
{children} | ||
</List> | ||
); | ||
}; | ||
|
||
export default ChipList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ListItem, { ListItemProps } from '@mui/material/ListItem'; | ||
|
||
interface ChipListItemProps extends ListItemProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
const ChipListItem: React.FC<ChipListItemProps> = ({ children, ...props }) => { | ||
return ( | ||
<ListItem | ||
{...props} | ||
data-testid="chip-list-item" | ||
sx={{ | ||
pr: 1, | ||
pl: 0, | ||
width: 'initial', | ||
}} | ||
> | ||
{children} | ||
</ListItem> | ||
); | ||
}; | ||
|
||
export default ChipListItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import Box, { BoxProps } from '@mui/material/Box'; | ||
import Typography from '@mui/material/Typography'; | ||
import Chip from '@mui/material/Chip'; | ||
import List from '@mui/material/List'; | ||
import ListItem from '@mui/material/ListItem'; | ||
|
||
import { WorkItemType } from './constants'; | ||
import ChipList from './ChipList'; | ||
import ChipListItem from './ChipListItem'; | ||
|
||
interface WorkPanelProps extends BoxProps { | ||
item: WorkItemType; | ||
} | ||
|
||
const WorkPanel: React.FC<WorkPanelProps> = ({ item, ...props }) => { | ||
return ( | ||
<Box {...props} role="tabpanel"> | ||
<Box sx={{ p: 3 }}> | ||
<Typography variant="h5" component="h2"> | ||
{item.company} | {item.title} | ||
</Typography> | ||
<Typography variant="overline"> | ||
{item.startDate} - {item.endDate} | ||
</Typography> | ||
<Typography variant="subtitle2">{item.location}</Typography> | ||
{!!item.experience.length && ( | ||
<List data-testid="experience-list"> | ||
{item.experience.map((experience, index) => { | ||
return ( | ||
<ListItem | ||
key={index} | ||
data-testid="experience-list-item" | ||
sx={(theme) => ({ | ||
'&::before': { | ||
content: '"-"', | ||
pr: theme.spacing(0.5), | ||
alignSelf: 'flex-start', | ||
}, | ||
})} | ||
> | ||
<Typography variant="body2">{experience}</Typography> | ||
</ListItem> | ||
); | ||
})} | ||
</List> | ||
)} | ||
{!!item.skills.length && ( | ||
<ChipList> | ||
{item.skills.map((skill) => { | ||
return ( | ||
<ChipListItem key={skill}> | ||
<Chip label={skill} color="primary" size="small" /> | ||
</ChipListItem> | ||
); | ||
})} | ||
</ChipList> | ||
)} | ||
{!!item.tools.length && ( | ||
<ChipList> | ||
{item.tools.map((tool) => { | ||
return ( | ||
<ChipListItem key={tool}> | ||
<Chip | ||
label={tool} | ||
variant="outlined" | ||
color="primary" | ||
size="small" | ||
/> | ||
</ChipListItem> | ||
); | ||
})} | ||
</ChipList> | ||
)} | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default WorkPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use client'; | ||
|
||
import { useState, SyntheticEvent } from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import Tabs from '@mui/material/Tabs'; | ||
import Tab from '@mui/material/Tab'; | ||
|
||
import { WorkItemType } from './constants'; | ||
import WorkPanel from './WorkPanel'; | ||
|
||
type GetIdType = (index: number) => string; | ||
|
||
const getTabId: GetIdType = (index) => `work-tab-${index}`; | ||
const getTabPanelId: GetIdType = (index) => `work-tabpanel-${index}`; | ||
|
||
type TabsOnChange = (event: SyntheticEvent, value: any) => void; | ||
|
||
interface WorkTabsProps { | ||
items: WorkItemType[]; | ||
} | ||
|
||
const WorkTabs: React.FC<WorkTabsProps> = ({ items }) => { | ||
const [value, setValue] = useState(0); | ||
|
||
const handleChange: TabsOnChange = (_, newValue) => { | ||
setValue(newValue); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ width: '100%' }}> | ||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||
<Tabs | ||
value={value} | ||
onChange={handleChange} | ||
aria-label="work experience tabs" | ||
variant="scrollable" | ||
scrollButtons | ||
allowScrollButtonsMobile | ||
// https://mui.com/base-ui/react-tabs/#keyboard-navigation | ||
selectionFollowsFocus | ||
> | ||
{items.map((item, index) => { | ||
return ( | ||
<Tab | ||
key={item.company} | ||
label={item.company} | ||
id={getTabId(index)} | ||
aria-controls={getTabPanelId(index)} | ||
/> | ||
); | ||
})} | ||
</Tabs> | ||
</Box> | ||
{items.map((item, index) => { | ||
const isActive = value === index; | ||
return ( | ||
<WorkPanel | ||
key={item.id} | ||
item={item} | ||
hidden={!isActive} | ||
id={getTabPanelId(index)} | ||
aria-labelledby={getTabId(index)} | ||
data-testid={item.id} | ||
/> | ||
); | ||
})} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default WorkTabs; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test will be completed in separate task #30