Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: favorite feature table icons (#2525)
- Loading branch information
Showing
12 changed files
with
477 additions
and
101 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
frontend/src/component/feature/FeatureToggleList/FavoriteIconCell/FavoriteIconCell.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,40 @@ | ||
import { VFC } from 'react'; | ||
import { Box, IconButton, styled } from '@mui/material'; | ||
import { | ||
Star as StarIcon, | ||
StarBorder as StarBorderIcon, | ||
} from '@mui/icons-material'; | ||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||
|
||
interface IFavoriteIconCellProps { | ||
value?: boolean; | ||
onClick?: () => void; | ||
} | ||
|
||
const InactiveIconButton = styled(IconButton)(({ theme }) => ({ | ||
color: 'transparent', | ||
'&:hover, &:focus': { | ||
color: theme.palette.primary.main, | ||
}, | ||
})); | ||
|
||
export const FavoriteIconCell: VFC<IFavoriteIconCellProps> = ({ | ||
value = false, | ||
onClick, | ||
}) => ( | ||
<Box sx={{ pl: 1.25 }}> | ||
<ConditionallyRender | ||
condition={value} | ||
show={ | ||
<IconButton onClick={onClick} color="primary" size="small"> | ||
<StarIcon fontSize="small" /> | ||
</IconButton> | ||
} | ||
elseShow={ | ||
<InactiveIconButton onClick={onClick} size="small"> | ||
<StarBorderIcon fontSize="small" /> | ||
</InactiveIconButton> | ||
} | ||
/> | ||
</Box> | ||
); |
45 changes: 45 additions & 0 deletions
45
frontend/src/component/feature/FeatureToggleList/FavoriteIconHeader/FavoriteIconHeader.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,45 @@ | ||
import { VFC } from 'react'; | ||
import { IconButton, Tooltip } from '@mui/material'; | ||
import { | ||
Star as StarIcon, | ||
StarBorder as StarBorderIcon, | ||
} from '@mui/icons-material'; | ||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||
|
||
interface IFavoriteIconHeaderProps { | ||
isActive: boolean; | ||
onClick: () => void; | ||
} | ||
|
||
export const FavoriteIconHeader: VFC<IFavoriteIconHeaderProps> = ({ | ||
isActive = false, | ||
onClick, | ||
}) => { | ||
return ( | ||
<Tooltip | ||
title={ | ||
isActive | ||
? 'Unpin favorite features from the top' | ||
: 'Pin favorite features to the top' | ||
} | ||
placement="bottom-start" | ||
> | ||
<IconButton | ||
sx={{ | ||
mx: -0.75, | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
onClick={onClick} | ||
size="small" | ||
> | ||
<ConditionallyRender | ||
condition={isActive} | ||
show={<StarIcon fontSize="small" />} | ||
elseShow={<StarBorderIcon fontSize="small" />} | ||
/> | ||
</IconButton> | ||
</Tooltip> | ||
); | ||
}; |
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
Oops, something went wrong.