-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
924 additions
and
164 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
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,107 @@ | ||
import AppsIcon from "@material-ui/icons/Apps"; | ||
import BookmarkBorderIcon from "@material-ui/icons/BookmarkBorder"; | ||
import CreateIcon from "@material-ui/icons/Create"; | ||
import DraftsIcon from "@material-ui/icons/Drafts"; | ||
import ExpandLessIcon from "@material-ui/icons/ExpandLess"; | ||
import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; | ||
import FileCopyIcon from "@material-ui/icons/FileCopy"; | ||
import InboxIcon from "@material-ui/icons/Inbox"; | ||
import InsertCommentIcon from "@material-ui/icons/InsertComment"; | ||
import PeopleAltIcon from "@material-ui/icons/PeopleAlt"; | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { SidebarOption } from "./SidebarOption"; | ||
import { StatusBadge } from "./StatusBadge"; | ||
import AddIcon from "@material-ui/icons/Add"; | ||
|
||
export const Sidebar: React.FC = () => { | ||
return ( | ||
<SidebarContainer> | ||
<SidebarHeader> | ||
<SidebarInfo> | ||
<h2>MartsTech HQ</h2> | ||
<h3> | ||
<SidebarStatus> | ||
<StatusBadge /> | ||
</SidebarStatus> | ||
Martin Velkov | ||
</h3> | ||
</SidebarInfo> | ||
<CreateIcon /> | ||
</SidebarHeader> | ||
|
||
<SidebarOption Icon={InsertCommentIcon} title="Threads" /> | ||
<SidebarOption Icon={InboxIcon} title="Mentions & reactions" /> | ||
<SidebarOption Icon={DraftsIcon} title="Saved items" /> | ||
<SidebarOption Icon={BookmarkBorderIcon} title="Channel browser" /> | ||
<SidebarOption Icon={PeopleAltIcon} title="People & user groups" /> | ||
<SidebarOption Icon={AppsIcon} title="Apps" /> | ||
<SidebarOption Icon={FileCopyIcon} title="File browser" /> | ||
<SidebarOption Icon={ExpandLessIcon} title="Show less" /> | ||
<hr /> | ||
<SidebarOption Icon={ExpandMoreIcon} title="Channels" /> | ||
<hr /> | ||
<SidebarOption Icon={AddIcon} title="Add Channel" addChannelOption /> | ||
</SidebarContainer> | ||
); | ||
}; | ||
|
||
const SidebarContainer = styled.div` | ||
color: white; | ||
background-color: var(--slack-color); | ||
flex: 0.3; | ||
border-top: 1px solid var(--sidebar-color); | ||
max-width: 260px; | ||
margin-top: 70px; | ||
> hr { | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
border: 1px solid var(--sidebar-color); | ||
} | ||
`; | ||
|
||
const SidebarHeader = styled.div` | ||
display: flex; | ||
border-bottom: 1px solid var(--sidebar-color); | ||
padding: 13px; | ||
> svg { | ||
padding: 8px; | ||
color: var(--sidebar-color); | ||
font-size: 18px; | ||
background-color: white; | ||
border-radius: 50%; | ||
} | ||
`; | ||
|
||
const SidebarInfo = styled.div` | ||
flex: 1; | ||
> h2 { | ||
font-size: 1rem; | ||
font-weight: 900; | ||
margin-bottom: 5px; | ||
} | ||
> h3 { | ||
display: flex; | ||
font-size: 0.9rem; | ||
font-weight: 400; | ||
align-items: center; | ||
} | ||
`; | ||
|
||
const SidebarStatus = styled.div` | ||
> span { | ||
margin-bottom: 3px !important; | ||
margin-right: 12px !important; | ||
} | ||
> span > span { | ||
object-fit: contain; | ||
height: 12px; | ||
width: 12px; | ||
border-radius: 50%; | ||
} | ||
`; |
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,67 @@ | ||
import { SvgIconTypeMap } from "@material-ui/core"; | ||
import { OverridableComponent } from "@material-ui/core/OverridableComponent"; | ||
import React from "react"; | ||
import { db } from "../firebase"; | ||
import styled from "styled-components"; | ||
|
||
interface SidebarOptionProps { | ||
Icon?: OverridableComponent<SvgIconTypeMap<{}, "svg">>; | ||
title?: string; | ||
addChannelOption?: boolean; | ||
} | ||
|
||
export const SidebarOption: React.FC<SidebarOptionProps> = ({ | ||
Icon, | ||
title, | ||
addChannelOption, | ||
}) => { | ||
const addChannel = () => { | ||
const channelName = prompt("Please enter the channel name"); | ||
|
||
if (channelName) { | ||
db.collection("rooms").add({ | ||
name: channelName, | ||
}); | ||
} | ||
}; | ||
|
||
const selectChannel = () => {}; | ||
|
||
return ( | ||
<SidebarOptionContainer | ||
onClick={addChannelOption ? addChannel : selectChannel} | ||
> | ||
{Icon && <Icon fontSize="small" style={{ padding: 10 }} />} | ||
{Icon ? ( | ||
<h3>{title}</h3> | ||
) : ( | ||
<SidebarOptionChannel> | ||
<span>#</span> {title} | ||
</SidebarOptionChannel> | ||
)} | ||
</SidebarOptionContainer> | ||
); | ||
}; | ||
|
||
const SidebarOptionContainer = styled.div` | ||
display: flex; | ||
font-size: 0.75rem; | ||
align-items: center; | ||
padding-left: 2px; | ||
cursor: pointer; | ||
:hover { | ||
opacity: 0.9; | ||
background-color: var(--sidebar-option-color); | ||
} | ||
> h3 { | ||
font-weight: 500; | ||
} | ||
> h3 > span { | ||
padding: 15px; | ||
} | ||
`; | ||
|
||
const SidebarOptionChannel = styled.div``; |
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,33 @@ | ||
import { Badge, createStyles, withStyles } from "@material-ui/core"; | ||
|
||
export const StatusBadge: React.FC = () => { | ||
const StyledBadge = withStyles(() => | ||
createStyles({ | ||
badge: { | ||
backgroundColor: "green", | ||
color: "green", | ||
"&::after": { | ||
position: "absolute", | ||
width: "100%", | ||
height: "100%", | ||
borderRadius: "50%", | ||
animation: "$ripple 1.2s infinite ease-in-out", | ||
border: "1px solid currentColor", | ||
content: '""', | ||
}, | ||
}, | ||
"@keyframes ripple": { | ||
"0%": { | ||
transform: "scale(.8)", | ||
opacity: 1, | ||
}, | ||
"100%": { | ||
transform: "scale(2.4)", | ||
opacity: 0, | ||
}, | ||
}, | ||
}) | ||
)(Badge); | ||
|
||
return <StyledBadge overlap="circle" variant="dot" />; | ||
}; |
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
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
Oops, something went wrong.