Last active
December 2, 2018 14:45
-
-
Save productioncoder/c991094fbdbb468b45c1fadaffb87865 to your computer and use it in GitHub Desktop.
Subscription component in Youtube
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
import React from 'react'; | |
import {Icon, Image, Menu} from "semantic-ui-react"; | |
import './Subscription.scss'; | |
export function Subscription(props) { | |
let rightElement = null; | |
const {broadcasting, amountNewVideos} = props; | |
if (broadcasting) { | |
rightElement = <Icon name='signal'/>; | |
} else if (amountNewVideos) { | |
rightElement = <span className='new-videos-count'>{amountNewVideos}</span>; | |
} | |
return ( | |
<Menu.Item> | |
<div className='subscription'> | |
<div> | |
<Image src='http://via.placeholder.com/28x28' avatar/> | |
<span>{props.label}</span> | |
</div> | |
{rightElement} | |
</div> | |
</Menu.Item> | |
); | |
} |
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
@import '../../../../styles/shared.scss'; | |
.subscription { | |
width: 100%; | |
display: flex; | |
justify-content: space-between; | |
align-items: center; | |
i.icon { | |
color: $red; | |
} | |
.new-videos-count { | |
color: $grey; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment