From 00bc662c7fc984e5676f2696ecc52e3b51d0d660 Mon Sep 17 00:00:00 2001 From: t1enne Date: Sun, 8 May 2022 10:45:45 +0200 Subject: [PATCH] Changed Logo and Header logo has two variants. Changed story to reflect that. Updated header --- web/components/common/Logo/Logo.module.scss | 28 ++++ web/components/common/Logo/Logo.tsx | 175 ++++++++++++++++++++ web/components/common/Logo/index.ts | 1 + web/components/common/index.ts | 1 + web/components/logo.tsx | 159 ------------------ web/components/main-layout.tsx | 2 +- web/components/ui/Header/Header.module.scss | 3 - web/components/ui/Header/Header.tsx | 5 +- web/stories/PageLogo.stories.tsx | 10 +- 9 files changed, 213 insertions(+), 171 deletions(-) create mode 100644 web/components/common/Logo/Logo.module.scss create mode 100644 web/components/common/Logo/Logo.tsx create mode 100644 web/components/common/Logo/index.ts delete mode 100644 web/components/logo.tsx diff --git a/web/components/common/Logo/Logo.module.scss b/web/components/common/Logo/Logo.module.scss new file mode 100644 index 000000000..c5d1c31ee --- /dev/null +++ b/web/components/common/Logo/Logo.module.scss @@ -0,0 +1,28 @@ +.root { + display: flex; + align-items: center; + justify-content: center; + width: max-content; + svg { + width: 50px; + height: 50px; + } +} + +.contrast { + padding: 5px; + border-radius: 50%; + background-color: var(--color-owncast-gray-100); + svg { + width: 40px; + height: 40px; + } +} + +.simple { + background-color: transparent; + svg { + width: 50px; + height: 50px; + } +} diff --git a/web/components/common/Logo/Logo.tsx b/web/components/common/Logo/Logo.tsx new file mode 100644 index 000000000..bdf98d376 --- /dev/null +++ b/web/components/common/Logo/Logo.tsx @@ -0,0 +1,175 @@ +import React from 'react'; +import cn from 'classnames'; +import s from './Logo.module.scss' + +interface Props { + variant: 'simple' | 'contrast' +} + +export default function Logo({variant = 'simple'}: Props) { + const rootClassName = cn( + s.root, + { + [s.simple]: variant === 'simple', + [s.contrast]: variant === 'contrast', + } + ) + + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {' '} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ); +} diff --git a/web/components/common/Logo/index.ts b/web/components/common/Logo/index.ts new file mode 100644 index 000000000..a5be7785e --- /dev/null +++ b/web/components/common/Logo/index.ts @@ -0,0 +1 @@ +export { default } from './Logo'; diff --git a/web/components/common/index.ts b/web/components/common/index.ts index b3a78beab..a4c62b745 100644 --- a/web/components/common/index.ts +++ b/web/components/common/index.ts @@ -1 +1,2 @@ export { default as UserDropdown } from './UserDropdown' +export { default as OwncastLogo } from './Logo' diff --git a/web/components/logo.tsx b/web/components/logo.tsx deleted file mode 100644 index eb2721a12..000000000 --- a/web/components/logo.tsx +++ /dev/null @@ -1,159 +0,0 @@ -import React from 'react'; - -export default function Logo() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {' '} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/web/components/main-layout.tsx b/web/components/main-layout.tsx index bebec70c3..fd80e3a0e 100644 --- a/web/components/main-layout.tsx +++ b/web/components/main-layout.tsx @@ -21,7 +21,7 @@ import classNames from 'classnames'; import { upgradeVersionAvailable } from '../utils/apis'; import { parseSecondsToDurationString } from '../utils/format'; -import OwncastLogo from './logo'; +import { OwncastLogo } from './common'; import { ServerStatusContext } from '../utils/server-status-context'; import { AlertMessageContext } from '../utils/alert-message-context'; diff --git a/web/components/ui/Header/Header.module.scss b/web/components/ui/Header/Header.module.scss index 5dd3678b4..0d9078ac1 100644 --- a/web/components/ui/Header/Header.module.scss +++ b/web/components/ui/Header/Header.module.scss @@ -7,9 +7,6 @@ .logo { display: flex; align-items: center; - svg { - height: 60px; - } span { margin-left: 1rem; font-size: 1.7rem; diff --git a/web/components/ui/Header/Header.tsx b/web/components/ui/Header/Header.tsx index 8ce96fb55..1f2268083 100644 --- a/web/components/ui/Header/Header.tsx +++ b/web/components/ui/Header/Header.tsx @@ -1,6 +1,5 @@ import { Layout } from 'antd'; -import { UserDropdown } from '../../common'; -import Logo from '../../logo'; +import { OwncastLogo, UserDropdown } from '../../common'; import s from './Header.module.scss'; const { Header } = Layout; @@ -13,7 +12,7 @@ export default function HeaderComponent({ name = 'Your stream title' }: Props) { return (
- + {name}
diff --git a/web/stories/PageLogo.stories.tsx b/web/stories/PageLogo.stories.tsx index 24c53a319..5934eef4e 100644 --- a/web/stories/PageLogo.stories.tsx +++ b/web/stories/PageLogo.stories.tsx @@ -1,15 +1,15 @@ import React from 'react'; import { ComponentStory, ComponentMeta } from '@storybook/react'; -import PageLogo from '../components/PageLogo'; +import { OwncastLogo } from '../components/common'; export default { - title: 'owncast/Page Logo', - component: PageLogo, + title: 'owncast/Logo', + component: OwncastLogo, parameters: {}, -} as ComponentMeta; +} as ComponentMeta; // eslint-disable-next-line @typescript-eslint/no-unused-vars -const Template: ComponentStory = args => ; +const Template: ComponentStory = args => ; // eslint-disable-next-line @typescript-eslint/no-unused-vars export const Logo = Template.bind({});