Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active December 2, 2018 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/c991094fbdbb468b45c1fadaffb87865 to your computer and use it in GitHub Desktop.
Save productioncoder/c991094fbdbb468b45c1fadaffb87865 to your computer and use it in GitHub Desktop.
Subscription component in Youtube
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>
);
}
@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