Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add channel icons & update how channel cards look to be in line with the updated design. #15524

Merged
merged 3 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@
import styled from 'styled-components'
import * as React from 'react'
import Flex from '../../../Flex'
import { getCardColor } from './colors'
import FollowButton from './FollowButton'
import { useChannelSubscribed } from './Context'
import { channels } from './Icons'

const SubscribeButton = styled(FollowButton)`
position: absolute;
top: 8px;
right: 8px;
`

const Container = styled(Flex) <{ backgroundColor: string }>`
const Container = styled(Flex)`
height: 80px;
font-weight: 600;
font-size: 14px;
border-radius: 8px;
background: ${p => p.backgroundColor};
padding: 16px 20px;
color: white;
position: relative;
box-shadow: 0px 2px 8px -1px rgba(0, 0, 0, 0.08), 0px 0.4px 1.5px rgba(0, 0, 0, 0.02);
border: 1px solid rgba(0, 0, 0, 0.08);

@media (prefers-color-scheme: dark) {
border: 1px solid rgba(255, 255, 255, 0.08);
}

&[data-channel-card-is-followed=true] {
&:not(:hover, :has(:focus-visible)) ${SubscribeButton} {
Expand All @@ -33,20 +37,34 @@ const Container = styled(Flex) <{ backgroundColor: string }>`
}
`

const IconContainer = styled.div`
width: 32px;
height: 32px;
padding: 8px;
border-radius: 100px;
background: rgba(0,0,0,0.2);
color: #6B7084;
display: flex;
align-items: center;
justify-content: center;
`

interface Props {
channelName: string
}

export default function ChannelCard ({ channelName }: Props) {
const { subscribed, setSubscribed } = useChannelSubscribed(channelName)
const icon = channels[channelName] ?? channels.default
return <Container
direction='column'
justify='center'
align='center'
backgroundColor={getCardColor(channelName)}
align='start'
gap={4}
data-channel-card-is-followed={subscribed}
>
<SubscribeButton following={subscribed} onClick={() => setSubscribed(!subscribed)} />
<IconContainer>{icon}</IconContainer>
{channelName}
</Container>
}
Loading