diff --git a/src/client/app.jsx b/src/client/app.jsx index 4676308..148ed15 100644 --- a/src/client/app.jsx +++ b/src/client/app.jsx @@ -18,7 +18,7 @@ const App = () => ( /> diff --git a/src/client/bar.jsx b/src/client/bar.jsx index 1ccd791..bfee614 100644 --- a/src/client/bar.jsx +++ b/src/client/bar.jsx @@ -33,10 +33,10 @@ export default function Bar(props) { className="bar__buttonIcon" role="img" aria-label={label} + title={label} > {icon} - {label} )) diff --git a/src/client/bar.scss b/src/client/bar.scss index 553be2d..68e24f4 100644 --- a/src/client/bar.scss +++ b/src/client/bar.scss @@ -51,24 +51,28 @@ } .bar__button { - background-color: #2a2a2a; + background-color: #303030; border: none; height: 3.5em; transition: 0.1s background-color; width: 3.5em; &:hover { - background-color: #272727; + background-color: #2a2a2a; } &.active { background-color: $color-active; } .closed &.active { - background-color: #2a2a2a; + background-color: #303030; + &:hover { + background-color: #2a2a2a; + } } } .bar__buttonIcon { display: flow-root; + font-size: 1.5em; } .bar__buttonText { diff --git a/src/client/channel.jsx b/src/client/channel.jsx new file mode 100644 index 0000000..85ef800 --- /dev/null +++ b/src/client/channel.jsx @@ -0,0 +1,65 @@ +import './channel.scss'; + +import classnames from 'classnames'; +import PropTypes from 'prop-types'; +import React, {useState} from 'react'; + +export default function Channel(props) { + const { + actions, + href, + name, + prefix, + } = props; + const [isActioning, setIsActioning] = useState(false); + return ( +
+ { + setIsActioning(!isActioning); + event.preventDefault(); + }} + > + {prefix} + {name} + +
+ {actions.map(({icon, label, onClick}, i) => ( + + ))} +
+
+ ); +} + +Channel.propTypes = { + actions: PropTypes.arrayOf(PropTypes.shape({ + icon: PropTypes.string, + label: PropTypes.string, + onClick: PropTypes.func, + })).isRequired, + href: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + prefix: PropTypes.string.isRequired, +}; diff --git a/src/client/channel.scss b/src/client/channel.scss new file mode 100644 index 0000000..59735ea --- /dev/null +++ b/src/client/channel.scss @@ -0,0 +1,37 @@ +.channel { + position: relative; +} + +.channel__link { + color: #ffffff; + display: block; + font-family: var(--title-font-family); + padding: 1em; + text-decoration: none; + .muted { + font-size: 0.8em; + margin-right: 0.125em; + } +} + +.channel__actions { + align-items: center; + display: flex; + padding-right: 0.5em; + position: absolute; + height: 3em; + right: 0; + top: 0; + transition: 0.2s right; + z-index: 10; +} + +.channel__action { + background-color: transparent; + border: 0; + color: inherit; + padding: 0.5em; + &:hover { + background-color: rgba(255, 255, 255, 0.1); + } +} diff --git a/src/client/chat--left.jsx b/src/client/chat--left.jsx index 0803866..539b10b 100644 --- a/src/client/chat--left.jsx +++ b/src/client/chat--left.jsx @@ -5,20 +5,23 @@ import React, {useState} from 'react'; import useBreakpoints from './hooks/useBreakpoints'; import Bar from './bar'; +import ChatLeftFriends from './chat--leftFriends'; +import ChatLeftRooms from './chat--leftRooms'; export default function ChatLeft() { const {desktop, tablet} = useBreakpoints(); + const [active, setActive] = useState(0); const [isOpen, setIsOpen] = useState(false); const toggleOpen = () => setIsOpen(!isOpen); const showsAsOpen = isOpen || desktop || !tablet; const buttons = [ { - icon: '📜', - label: 'chat', + icon: '💬', + label: 'Chat', }, { icon: '😁', - label: 'friends', + label: 'Friends', }, ]; return ( @@ -33,29 +36,11 @@ export default function ChatLeft() { if (i === active || !isOpen) { toggleOpen(); } + setActive(active); }} /> - -

Chats

- + {0 === active && } + {1 === active && } ); } diff --git a/src/client/chat--left.scss b/src/client/chat--left.scss index 9b0d588..6f6f893 100644 --- a/src/client/chat--left.scss +++ b/src/client/chat--left.scss @@ -13,54 +13,3 @@ .left.open { width: 18em; } - -.channel__join[class] { - background-color: #272727; - flex-wrap: nowrap; - white-space: nowrap; -} - -.channel__joinTextWrapper::before { - content: '/r/'; - font-size: 0.8em; - padding: 0 0.25em 0 0.5em; - position: relative; - top: 1px; -} - -.channel__joinText { - padding-left: 0.25em; -} - -.channel__chatsTitle { - color: $color-muted; - font-family: var(--thick-title-font-family); - font-size: 0.7em; - font-weight: bold; - padding: 2.5em 1em 0.625em 1.375em; - text-transform: uppercase; -} - -.channel__chatsList li { - &:nth-of-type(even) { - background-color: rgba(0, 0, 0, 0.1); - } - &:nth-of-type(odd) { - background-color: rgba(0, 0, 0, 0.2); - } -} - -.channel__chatsList a { - color: #ffffff; - display: block; - font-family: var(--title-font-family); - padding: 1em; - text-decoration: none; - .muted { - font-size: 0.8em; - margin-right: 0.125em; - } - &:hover { - background-color: #444; - } -} diff --git a/src/client/chat--leftFriends.jsx b/src/client/chat--leftFriends.jsx new file mode 100644 index 0000000..026d64e --- /dev/null +++ b/src/client/chat--leftFriends.jsx @@ -0,0 +1,81 @@ +import './chat--leftFriends.scss'; + +import classnames from 'classnames'; +import React from 'react'; +import {useParams} from 'react-router-dom'; + +import Channel from './channel'; + +export default function ChatLeftRooms() { + const {type, name} = useParams(); + const favorites = ['BabeHasHiccups']; + const friends = ['BabeHasHiccups', 'mystifired'].filter((channel) => -1 === favorites.indexOf(channel)); + const favoritesActions = [ + { + icon: '💔', + label: 'Unfavorite', + onClick: () => {}, + }, + ]; + const friendsActions = [ + { + icon: '❤️', + label: 'Favorite', + onClick: () => {}, + }, + { + icon: '🚫', + label: 'Unfriend', + onClick: () => {}, + }, + { + icon: '☢️', + label: 'Block', + onClick: () => {}, + }, + ]; + return ( +
+ +

Favorites

+
    + {favorites.map((channel) => ( +
  • + +
  • + ))} +
+

Friends

+
    + {friends.map((channel) => ( +
  • + +
  • + ))} +
+
+ ); +} + +ChatLeftRooms.propTypes = {}; diff --git a/src/client/chat--leftFriends.scss b/src/client/chat--leftFriends.scss new file mode 100644 index 0000000..70b8988 --- /dev/null +++ b/src/client/chat--leftFriends.scss @@ -0,0 +1,51 @@ +@import '~/client/scss/colors.scss'; + +.friends__add[class] { + background-color: #272727; + flex-wrap: nowrap; + white-space: nowrap; +} + +.friends__addTextWrapper::before { + content: '/u/'; + font-size: 0.8em; + padding: 0 0.25em 0 0.5em; + position: relative; + top: 1px; +} + +.friends__addText { + padding-left: 0.25em; +} + +.friends__chatsTitle { + color: $color-muted; + font-family: var(--thick-title-font-family); + font-size: 0.7em; + font-weight: bold; + padding: 2.5em 1em 0.625em 1.375em; + text-transform: uppercase; +} + +.friends__item { + position: relative; + width: 100%; + &:nth-of-type(even) { + background-color: rgba(0, 0, 0, 0.1); + &:hover { + background-color: rgba(255, 255, 255, 0.2); + } + } + &:nth-of-type(odd) { + background-color: rgba(0, 0, 0, 0.2); + &:hover { + background-color: rgba(255, 255, 255, 0.1); + } + } + &.active[class] { + background-color: $color-active; + &:hover { + background-color: lighten($color-active, 5%); + } + } +} diff --git a/src/client/chat--leftRooms.jsx b/src/client/chat--leftRooms.jsx new file mode 100644 index 0000000..ee0654e --- /dev/null +++ b/src/client/chat--leftRooms.jsx @@ -0,0 +1,76 @@ +import './chat--leftRooms.scss'; + +import classnames from 'classnames'; +import React from 'react'; +import {useParams} from 'react-router-dom'; + +import Channel from './channel'; + +export default function ChatLeftRooms() { + const {type, name} = useParams(); + const favorites = ['reddichat']; + const recent = ['reddichat', 'anonymous'].filter((channel) => -1 === favorites.indexOf(channel)); + const favoritesActions = [ + { + icon: '💔', + label: 'Unfavorite', + onClick: () => {}, + }, + ]; + const recentActions = [ + { + icon: '❤️', + label: 'Favorite', + onClick: () => {}, + }, + { + icon: '×', + label: 'Close', + onClick: () => {}, + }, + ]; + return ( +
+ +

Favorites

+
    + {favorites.map((channel) => ( +
  • + +
  • + ))} +
+

Recent

+
    + {recent.map((channel) => ( +
  • + +
  • + ))} +
+
+ ); +} + +ChatLeftRooms.propTypes = {}; diff --git a/src/client/chat--leftRooms.scss b/src/client/chat--leftRooms.scss new file mode 100644 index 0000000..1dd331d --- /dev/null +++ b/src/client/chat--leftRooms.scss @@ -0,0 +1,51 @@ +@import '~/client/scss/colors.scss'; + +.channels__join[class] { + background-color: #272727; + flex-wrap: nowrap; + white-space: nowrap; +} + +.channels__joinTextWrapper::before { + content: '/r/'; + font-size: 0.8em; + padding: 0 0.25em 0 0.5em; + position: relative; + top: 1px; +} + +.channels__joinText { + padding-left: 0.25em; +} + +.channels__chatsTitle { + color: $color-muted; + font-family: var(--thick-title-font-family); + font-size: 0.7em; + font-weight: bold; + padding: 2.5em 1em 0.625em 1.375em; + text-transform: uppercase; +} + +.channels__item { + position: relative; + width: 100%; + &:nth-of-type(even) { + background-color: rgba(0, 0, 0, 0.1); + &:hover { + background-color: rgba(255, 255, 255, 0.2); + } + } + &:nth-of-type(odd) { + background-color: rgba(0, 0, 0, 0.2); + &:hover { + background-color: rgba(255, 255, 255, 0.1); + } + } + &.active[class] { + background-color: $color-active; + &:hover { + background-color: lighten($color-active, 5%); + } + } +} diff --git a/src/client/chat--right.jsx b/src/client/chat--right.jsx index e711aee..7f3acd3 100644 --- a/src/client/chat--right.jsx +++ b/src/client/chat--right.jsx @@ -14,7 +14,7 @@ export default function ChatRight() { const buttons = [ { icon: '🙃', - label: 'present', + label: 'Present', }, ]; return ( diff --git a/src/client/chat--right.scss b/src/client/chat--right.scss index 401325d..2d21156 100644 --- a/src/client/chat--right.scss +++ b/src/client/chat--right.scss @@ -11,7 +11,7 @@ } .right .bar--vertical { - float: right; + float: left; } .right.open {