From 7e3dc4ace4c6b21bc68264dc76c8c442aec8031a Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Mon, 8 May 2023 14:45:55 -0600 Subject: standardize component structure more --- components/InfoBar/InfoBar.module.css | 34 ++++++++++++++++++ components/InfoBar/index.tsx | 66 +++++++++++++++++++++++++++++++++++ components/layout/Footer.tsx | 9 +++++ components/layout/Header.tsx | 43 +++++++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 components/InfoBar/InfoBar.module.css create mode 100644 components/InfoBar/index.tsx create mode 100644 components/layout/Footer.tsx create mode 100644 components/layout/Header.tsx (limited to 'components') diff --git a/components/InfoBar/InfoBar.module.css b/components/InfoBar/InfoBar.module.css new file mode 100644 index 0000000..7786bd1 --- /dev/null +++ b/components/InfoBar/InfoBar.module.css @@ -0,0 +1,34 @@ +.infobar { + margin: calc(-1 * var(--text-padding)); + margin-bottom: var(--text-padding); + padding: var(--text-padding); + background: var(--main-background); + height: var(--header-bar-height); + width: var(--main-width); + box-sizing: border-box; + display: flex; + flex-direction: row; + align-items: center; + border-bottom: solid 1px var(--text-dimmed); +} + +.infobar.sideNote { + color: var(--text-dimmed); + font-style: italic; +} + +.infobar.postMeta { + color: var(--text-dimmed); +} + +.infobar.postMeta .author { + color: var(--text-medium); +} + +.infobar.postMeta .date { + font-style: italic; +} + +.infobar + p { + margin-top: 0; +} diff --git a/components/InfoBar/index.tsx b/components/InfoBar/index.tsx new file mode 100644 index 0000000..cb5ac9a --- /dev/null +++ b/components/InfoBar/index.tsx @@ -0,0 +1,66 @@ +import { ReactNode } from 'react' +import styles from './InfoBar.module.css' + +interface ArbitraryChildrenProps { + children: ReactNode +} + +interface SideNoteProps { + text: string +} + +interface PostInfoPros { + publishedDate: Date, + authorName: string +} + +interface SystemMemberInfoProps { + memberName: string, + memberAvatar: string +} + +type InfobarProps = ( + ArbitraryChildrenProps + | SideNoteProps + | PostInfoPros + | SystemMemberInfoProps +) + +export default function InfoBar(props: InfobarProps) { + if ('text' in props) { + return ( + + ) + } + + if ('authorName' in props) { + return ( + + ) + } + + if ('memberName' in props) { + return ( + + ) + } + + if ('children' in props) { + return ( + + ) + } + + throw new Error('Unknown infobar type') +} diff --git a/components/layout/Footer.tsx b/components/layout/Footer.tsx new file mode 100644 index 0000000..f18c60d --- /dev/null +++ b/components/layout/Footer.tsx @@ -0,0 +1,9 @@ +export default function Footer() { + return ( + + ) +} diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx new file mode 100644 index 0000000..23ba4b2 --- /dev/null +++ b/components/layout/Header.tsx @@ -0,0 +1,43 @@ +'use client' + +import React from 'react' +import Image from 'next/image' + +import { usePathname } from 'next/navigation' + +import header from '~/images/aurora-1197753.jpg' + +export default function Title() { + const pathname = usePathname() + + const isHomepage = pathname === '/' + + return ( +
+ {isHomepage + ?

tempest.dev

+ : tempest.dev + } + +
+ +
+
+ ) +} -- cgit 1.4.1