diff options
Diffstat (limited to 'components')
-rw-r--r-- | components/InfoBar/InfoBar.module.css | 34 | ||||
-rw-r--r-- | components/InfoBar/index.tsx | 66 | ||||
-rw-r--r-- | components/layout/Footer.tsx | 9 | ||||
-rw-r--r-- | components/layout/Header.tsx | 43 |
4 files changed, 152 insertions, 0 deletions
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 ( + <aside className={`${styles.infobar} ${styles.sideNote}`}> + {props.text} + </aside> + ) + } + + if ('authorName' in props) { + return ( + <aside className={`${styles.infobar} ${styles.postMeta}`}> + <span> + by <span className={styles.author}>{props.authorName}</span>;{' '} + <span className={styles.date}>published {props.publishedDate.toLocaleDateString()}</span> + </span> + </aside> + ) + } + + if ('memberName' in props) { + return ( + <aside className={`${styles.infobar} ${styles.sideNote}`}> + {props.memberName} + </aside> + ) + } + + if ('children' in props) { + return ( + <aside className={styles.infobar}> + {props.children} + </aside> + ) + } + + 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 ( + <footer> + <span>Website by ashelyn rose</span> + <a href="https://git.tempest.dev/ashe/tempest.dev">Site Source</a> + <a href="/pay-transparency">Pay Transparency</a> + </footer> + ) +} 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 ( + <header className={isHomepage ? 'homepage' : undefined}> + {isHomepage + ? <h1 className="siteTitle">tempest.dev</h1> + : <a href="/" className="siteTitle">tempest.dev</a> + } + <nav> + <a href="/about">about</a> + <a href="/posts">posts</a> + <a href="/contact">contact</a> + </nav> + <div className="headerBackground"> + <Image + src={header} + alt="" + role="presentation" + fill={true} + sizes={` + (max-width: 2560) 100vw, + (max-width: 1920) 100vw, + (max-width: 1280) 100vw, + (max-width: 800) 100vw, + (max-width: 600) 100vw, + `} + /> + </div> + </header> + ) +} |