-
-
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.
feat(home): add an option to disable/enable opening channels on name …
…click
- Loading branch information
Showing
5 changed files
with
43 additions
and
6 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
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
32 changes: 32 additions & 0 deletions
32
src/ui/components/pages/Home/ChannelRenderer/ChannelTitle/ChannelName.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,32 @@ | ||
import React from 'react'; | ||
import { SxProps, Typography } from '@mui/material'; | ||
import { Channel, HomeView } from 'types'; | ||
import { useAppSelector } from 'store'; | ||
import { selectViewChannelOption } from 'store/selectors/settings'; | ||
import ChannelLink from './ChannelLink'; | ||
|
||
interface ChannelNameProps { | ||
view: HomeView; | ||
channel: Channel; | ||
} | ||
|
||
function ChannelName(props: ChannelNameProps) { | ||
const { view, channel } = props; | ||
const openChannelOnNameClick = useAppSelector( | ||
selectViewChannelOption(view, 'openChannelOnNameClick'), | ||
); | ||
|
||
const renderName = (sx?: SxProps) => ( | ||
<Typography sx={sx} variant="subtitle1" color="text.primary"> | ||
{channel.title} | ||
</Typography> | ||
); | ||
|
||
return openChannelOnNameClick ? ( | ||
<ChannelLink channel={channel}>{renderName()}</ChannelLink> | ||
) : ( | ||
renderName({ cursor: 'default' }) | ||
); | ||
} | ||
|
||
export default ChannelName; |
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