From 5b77ed439ff530e78c5840983f8f7f18f23586fd Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 19 Jun 2021 15:29:04 +0100 Subject: [PATCH] Port navigation. --- package.json | 1 + src/components/common/ChannelIcon.tsx | 29 +- src/components/common/IconBase.tsx | 14 +- src/components/common/ServerIcon.tsx | 26 +- src/components/common/UserHeader.tsx | 79 +++++ src/components/common/UserIcon.tsx | 3 +- src/components/common/UserStatus.tsx | 31 ++ src/components/navigation/LeftSidebar.tsx | 32 ++ src/components/navigation/RightSidebar.tsx | 20 ++ src/components/navigation/SidebarBase.tsx | 8 + .../navigation/items/ButtonItem.tsx | 157 +++++++++ .../navigation/items/ConnectionStatus.tsx | 35 ++ .../navigation/items/Item.module.scss | 303 ++++++++++++++++++ .../navigation/left/HomeSidebar.tsx | 160 +++++++++ .../navigation/left/ServerListSidebar.tsx | 215 +++++++++++++ .../navigation/left/ServerSidebar.tsx | 78 +++++ src/components/navigation/left/common.ts | 74 +++++ src/components/ui/Category.tsx | 45 +++ src/components/ui/Header.tsx | 32 ++ src/context/revoltjs/hooks.ts | 2 +- src/lib/PaintCounter.tsx | 10 +- src/pages/App.tsx | 11 +- src/redux/connector.tsx | 11 +- src/styles/index.scss | 2 + yarn.lock | 5 + 25 files changed, 1341 insertions(+), 42 deletions(-) create mode 100644 src/components/common/UserHeader.tsx create mode 100644 src/components/common/UserStatus.tsx create mode 100644 src/components/navigation/LeftSidebar.tsx create mode 100644 src/components/navigation/RightSidebar.tsx create mode 100644 src/components/navigation/SidebarBase.tsx create mode 100644 src/components/navigation/items/ButtonItem.tsx create mode 100644 src/components/navigation/items/ConnectionStatus.tsx create mode 100644 src/components/navigation/items/Item.module.scss create mode 100644 src/components/navigation/left/HomeSidebar.tsx create mode 100644 src/components/navigation/left/ServerListSidebar.tsx create mode 100644 src/components/navigation/left/ServerSidebar.tsx create mode 100644 src/components/navigation/left/common.ts create mode 100644 src/components/ui/Category.tsx create mode 100644 src/components/ui/Header.tsx diff --git a/package.json b/package.json index 7ae71682..1048e99a 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@types/styled-components": "^5.1.10", "@typescript-eslint/eslint-plugin": "^4.27.0", "@typescript-eslint/parser": "^4.27.0", + "classnames": "^2.3.1", "dayjs": "^1.10.5", "detect-browser": "^5.2.0", "eslint": "^7.28.0", diff --git a/src/components/common/ChannelIcon.tsx b/src/components/common/ChannelIcon.tsx index 8be9fe80..af245c3f 100644 --- a/src/components/common/ChannelIcon.tsx +++ b/src/components/common/ChannelIcon.tsx @@ -1,7 +1,7 @@ import { useContext } from "preact/hooks"; import { Hash } from "@styled-icons/feather"; -import IconBase, { IconBaseProps } from "./IconBase"; import { Channels } from "revolt.js/dist/api/objects"; +import { ImageIconBase, IconBaseProps } from "./IconBase"; import { AppContext } from "../../context/revoltjs/RevoltClient"; interface Props extends IconBaseProps { @@ -9,10 +9,10 @@ interface Props extends IconBaseProps, keyof Props>) { +export default function ChannelIcon(props: Props & Omit, keyof Props>) { const { client } = useContext(AppContext); - const { size, target, attachment, isServerChannel: server, animate, children, as, ...svgProps } = props; + const { size, target, attachment, isServerChannel: server, animate, children, as, ...imgProps } = props; const iconURL = client.generateFileURL(target?.icon ?? attachment, { max_side: 256 }, animate); const isServerChannel = server || target?.channel_type === 'TextChannel'; @@ -25,21 +25,18 @@ export default function ChannelIcon(props: Props & Omit + +