From 5b398f83437a9644401e938c7a3fb0b849665d15 Mon Sep 17 00:00:00 2001 From: William Tran Date: Mon, 31 May 2021 01:12:03 -0400 Subject: [PATCH] Fix styling for Link --- components/OrganizedContent.module.css | 52 +++++++++++++++----------- components/OrganizedContent.tsx | 8 ++-- components/playground.tsx | 3 +- pages/_app.css | 2 + 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/components/OrganizedContent.module.css b/components/OrganizedContent.module.css index 21ba2910..5a28bf3a 100644 --- a/components/OrganizedContent.module.css +++ b/components/OrganizedContent.module.css @@ -14,17 +14,42 @@ .navOption { display: flex; - width: max-content; - padding: 0.5rem 2rem 0.5rem 0.5rem; + overflow: hidden; + white-space: nowrap; font-size: 0.875rem; } +.navLink { + width: 100%; + cursor: pointer; + padding: 0.5rem 2rem 0.5rem 0.5rem; +} + +.readAll { + font-weight: bold; +} + .divider { border-bottom: 1px solid var(--blue-2); opacity: 0.25; width: '100%', } +.selectedHeadingArea > .navOption { + color: var(--blue-2); + font-weight: bold; +} + +.selectedHeadingArea { + background-color: var(--blue-1-05); +} + +.selectedMarker { + background-color: var(--blue-2); + width: calc(4rem / 16); + margin: 0.4rem 0.1rem 0.4rem 0.5rem; +} + .footer { margin-top: 1rem; display: flex; @@ -35,25 +60,6 @@ display: flex; } -.selectedHeadingArea > .navOption { - color: var(--blue-2); - font-weight: bold; -} - -.selectedHeadingArea { - background-color: rgba(92, 175, 249, 0.05); -} - -.selectedMarker { - background-color: var(--blue-2); - width: calc(4rem / 16); - margin-right: 0.5rem; -} - -.readAll { - font-weight: bold; -} - .arrowHeading { color: var(--blue-2); font-size: 0.875rem; @@ -92,6 +98,10 @@ display: flex; } +.footerDivider { + width: 1rem; +} + @media only screen and (max-width: calc(768rem / 16)) { .nav { display: none; diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index bdbd7782..f98bf3ab 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -2,8 +2,9 @@ import React, { ReactNode, ComponentType } from "react"; import styles from "./OrganizedContent.module.css"; export interface LinkProps { - children: string | ReactNode | (string | ReactNode)[]; + className: string; url: string; + children: string | ReactNode | (string | ReactNode)[]; } type Link = ComponentType; @@ -68,7 +69,6 @@ export const OrganizedContent = ({ ); }; -//todo push class to link const Nav = ({ headings, currentIndex, link: Link }: ChildProps) => { return (
@@ -87,7 +87,9 @@ const Nav = ({ headings, currentIndex, link: Link }: ChildProps) => { {index === currentIndex && ( )} - {heading.name} + + {heading.name} +
diff --git a/components/playground.tsx b/components/playground.tsx index 41f2de0b..e6fa1241 100644 --- a/components/playground.tsx +++ b/components/playground.tsx @@ -206,9 +206,10 @@ export function OrganizedContentDemo() { const [index, setIndex] = useState(0); - function FakeLink({ url, children }: LinkProps) { + function FakeLink({ className, url, children }: LinkProps) { return (
{ const target = sections.findIndex((section) => section.url === url); diff --git a/pages/_app.css b/pages/_app.css index d55f4e2c..69825f5f 100644 --- a/pages/_app.css +++ b/pages/_app.css @@ -9,6 +9,7 @@ body { --teal-1: #76ffdc; --teal-2: #4ed4b2; --blue-1: #5caff9; + --blue-1-05: #5caff90D; --blue-1-20: #5caff934; --blue-2: #1482e3; --purple-1: #525284; @@ -27,6 +28,7 @@ body { --teal-1: #76ffdc; --teal-2: #4ed4b2; --blue-1: #5caff9; + --blue-1-05: #5caff90D; --blue-1-20: #5caff934; --blue-2: #1482e3; --purple-1: #525284;