Download discord-react-clone/src/components/Channels/Channel.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 845 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/discord-react-clone/src/components/Channels/Channel.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/discord-react-clone/src/components/Channels/Channel.js
-
curl -L -o Channel.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/discord-react-clone/src/components/Channels/Channel.js
845 Bytes
| import React from 'react'; | |
| import styled from 'styled-components'; | |
| import colors from '../../utils/colors'; | |
| import ChannelName from '../ChannelName'; | |
| const StyledChannel = styled.div` | |
| margin: 2px 0 2px 8px; | |
| padding: 0 8px; | |
| height: 32px; | |
| background-color: ${props => (props.isSelected ? colors.channelSelected : 0)}; | |
| border-radius: 3px; | |
| cursor: pointer; | |
| display: flex; | |
| align-items: center; | |
| :hover { | |
| background-color: ${props => (props.isSelected ? colors.channelSelected : colors.grayLight)}; | |
| span { | |
| color: ${props => (props.isSelected ? 0 : colors.channelHoveredText)}; | |
| } | |
| } | |
| `; | |
| const Channel = ({ name, isSelected, onClick }) => ( | |
| <StyledChannel isSelected={isSelected} onClick={onClick}> | |
| <ChannelName name={name} textColor={isSelected && '#fff'} /> | |
| </StyledChannel> | |
| ); | |
| export default Channel; | |