-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDE/PKFE-44 initial commit for sorting
- Loading branch information
1 parent
f492789
commit 7e92594
Showing
13 changed files
with
530 additions
and
34 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
63 changes: 63 additions & 0 deletions
63
app/front-end/src/features/editor/components/editorView/editorColumnMenuSortItem.tsx
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,63 @@ | ||
import { SortEnum } from '@/features/editor/types'; | ||
import { | ||
ArrowDownward as ArrowDownwardIcon, | ||
ArrowUpward as ArrowUpwardIcon, | ||
Remove as RemoveIcon, | ||
} from '@mui/icons-material'; | ||
import { Box, Button, Typography, useTheme } from '@mui/material'; | ||
import { MouseEvent as MouseEventReact } from 'react'; | ||
|
||
export interface EditorColumnMenuSortItemProps { | ||
onClick: (event: MouseEventReact<HTMLButtonElement, MouseEvent>) => void; | ||
onSort: (sort: SortEnum) => void; | ||
} | ||
|
||
export const EditorColumnMenuSortItem: React.FC<EditorColumnMenuSortItemProps> = ({ onClick, onSort }) => { | ||
const Theme = useTheme(); | ||
|
||
const handleClick = (event: MouseEventReact<HTMLButtonElement, MouseEvent>, sort: SortEnum) => { | ||
onClick(event); | ||
switch (sort) { | ||
case SortEnum.ASC: | ||
onSort(SortEnum.ASC); | ||
break; | ||
case SortEnum.DESC: | ||
onSort(SortEnum.DESC); | ||
break; | ||
default: | ||
onSort(SortEnum.NONE); | ||
} | ||
}; | ||
|
||
return ( | ||
<Box sx={{ display: 'flex', flexDirection: 'column' }}> | ||
<Button | ||
onClick={(event) => handleClick(event, SortEnum.ASC)} | ||
sx={{ justifyContent: 'left', px: '0.85rem', borderRadius: '0' }} | ||
> | ||
<Box sx={{ display: 'flex', flexDirection: 'row', gap: '1rem', alignItems: 'center' }}> | ||
<ArrowUpwardIcon sx={{ color: Theme.palette.text.secondary }} /> | ||
<Typography>Sort ASC</Typography> | ||
</Box> | ||
</Button> | ||
<Button | ||
onClick={(event) => handleClick(event, SortEnum.DESC)} | ||
sx={{ justifyContent: 'left', px: '0.85rem', borderRadius: '0' }} | ||
> | ||
<Box sx={{ display: 'flex', flexDirection: 'row', gap: '1rem', alignItems: 'center' }}> | ||
<ArrowDownwardIcon sx={{ color: Theme.palette.text.secondary }} /> | ||
<Typography>Sort DESC</Typography> | ||
</Box> | ||
</Button> | ||
<Button | ||
onClick={(event) => handleClick(event, SortEnum.NONE)} | ||
sx={{ justifyContent: 'left', px: '0.85rem', borderRadius: '0' }} | ||
> | ||
<Box sx={{ display: 'flex', flexDirection: 'row', gap: '1rem', alignItems: 'center' }}> | ||
<RemoveIcon sx={{ color: Theme.palette.text.secondary }} /> | ||
<Typography>Unsort</Typography> | ||
</Box> | ||
</Button> | ||
</Box> | ||
); | ||
}; |
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
2 changes: 2 additions & 0 deletions
2
app/front-end/src/features/editor/components/editorView/index.ts
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
File renamed without changes.
Oops, something went wrong.