-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(channels): enhance channels search
- Loading branch information
Showing
3 changed files
with
168 additions
and
155 deletions.
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
57 changes: 57 additions & 0 deletions
57
src/ui/components/pages/Channels/ChannelResults/PickChannelActions.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,57 @@ | ||
import React from 'react'; | ||
import { Tooltip, IconButton, Fade } from '@mui/material'; | ||
import CheckIcon from '@mui/icons-material/Check'; | ||
import { Channel } from 'types'; | ||
import { useAppDispatch } from 'store'; | ||
import { addChannel } from 'store/reducers/channels'; | ||
import ChannelActions from '../ChannelCard/ChannelActions'; | ||
|
||
interface PickChannelActionsProps { | ||
channel: Channel; | ||
canEdit?: boolean; | ||
} | ||
|
||
function PickChannelActions(props: PickChannelActionsProps) { | ||
const { channel, canEdit } = props; | ||
const dispatch = useAppDispatch(); | ||
|
||
const handleClick = () => { | ||
dispatch(addChannel(channel)); | ||
}; | ||
|
||
return canEdit ? ( | ||
<Fade in={true}> | ||
<ChannelActions channel={channel} /> | ||
</Fade> | ||
) : ( | ||
<Tooltip title="Add channel" placement="left" arrow> | ||
<Fade in={true}> | ||
<IconButton | ||
sx={{ | ||
border: 1, | ||
transition: (theme) => | ||
theme.transitions.create([ | ||
'color', | ||
'background-color', | ||
'border-color', | ||
]), | ||
borderColor: 'custom.lightBorder', | ||
':hover': { | ||
bgcolor: 'secondary.main', | ||
color: 'common.white', | ||
borderColor: 'secondary.main', | ||
}, | ||
}} | ||
size="small" | ||
aria-label="add" | ||
onClick={handleClick} | ||
disableRipple | ||
> | ||
<CheckIcon /> | ||
</IconButton> | ||
</Fade> | ||
</Tooltip> | ||
); | ||
} | ||
|
||
export default PickChannelActions; |
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