From b952f18b8c47d29eab2a66c864dcf48342e7b910 Mon Sep 17 00:00:00 2001 From: PartyParrotGreg <2233348+partyparrotgreg@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:11:47 +0000 Subject: [PATCH 01/13] chore(insights): add mobile menu component with styles and update stats rendering in PriceFeeds --- apps/insights/.env.development | 1 + .../src/components/CopyButton/index.tsx | 1 - .../MobileMenu/mobile-menu.module.scss | 54 +++++++++++++ .../components/MobileMenu/mobile-menu.v2.tsx | 75 +++++++++++++++++++ .../src/components/PriceFeeds/index.tsx | 59 ++++++++------- .../src/components/Root/footer.module.scss | 11 ++- apps/insights/src/components/Root/footer.tsx | 5 +- .../src/components/Root/header.module.scss | 70 +++++++++++------ apps/insights/src/components/Root/header.tsx | 34 +++++---- .../src/components/Root/search-button.tsx | 2 +- .../Root/support-drawer.module.scss | 15 ++-- .../src/components/Stats/index.module.scss | 56 ++++++++++++++ apps/insights/src/components/Stats/index.tsx | 9 +++ .../src/Button/index.module.scss | 5 +- .../src/Card/index.module.scss | 1 + .../src/Drawer/index.module.scss | 25 ++++++- packages/component-library/src/Html/base.scss | 4 + .../src/MainNavTabs/index.module.scss | 20 +++++ .../src/SingleToggleGroup/index.module.scss | 2 +- packages/component-library/src/theme.scss | 54 +++++++++++++ 20 files changed, 426 insertions(+), 77 deletions(-) create mode 100644 apps/insights/.env.development create mode 100644 apps/insights/src/components/MobileMenu/mobile-menu.module.scss create mode 100644 apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx create mode 100644 apps/insights/src/components/Stats/index.module.scss create mode 100644 apps/insights/src/components/Stats/index.tsx diff --git a/apps/insights/.env.development b/apps/insights/.env.development new file mode 100644 index 0000000000..addc9dd5a0 --- /dev/null +++ b/apps/insights/.env.development @@ -0,0 +1 @@ +DISABLE_ACCESSIBILITY_REPORTING=true \ No newline at end of file diff --git a/apps/insights/src/components/CopyButton/index.tsx b/apps/insights/src/components/CopyButton/index.tsx index f002ccbbbc..53de57de10 100644 --- a/apps/insights/src/components/CopyButton/index.tsx +++ b/apps/insights/src/components/CopyButton/index.tsx @@ -27,7 +27,6 @@ export const CopyButton = ({ text, children, className, ...props }: Props) => { const [isCopied, setIsCopied] = useState(false); const logger = useLogger(); const copy = useCallback(() => { - // eslint-disable-next-line n/no-unsupported-features/node-builtins navigator.clipboard .writeText(text) .then(() => { diff --git a/apps/insights/src/components/MobileMenu/mobile-menu.module.scss b/apps/insights/src/components/MobileMenu/mobile-menu.module.scss new file mode 100644 index 0000000000..668e96c1f2 --- /dev/null +++ b/apps/insights/src/components/MobileMenu/mobile-menu.module.scss @@ -0,0 +1,54 @@ +@use "@pythnetwork/component-library/theme"; + +.mobileMenuTrigger { + display: none; + + @include theme.mobile { + display: block; + } +} + +.mobileMenuOverlay { + background: rgb(0 0 0 / 40%); + position: fixed; + inset: 0; + z-index: 999; +} + +.mobileMenuContainer { + border-top-left-radius: theme.border-radius("2xl"); + border-top-right-radius: theme.border-radius("2xl"); + background: theme.color("background", "modal"); + position: absolute; + bottom: 0; + left: 0; + right: 0; + padding: 1rem; + display: flex; + flex-flow: column nowrap; + gap: theme.spacing(4); +} + +.mobileMenuHandle { + background: theme.color("background", "secondary"); + width: 33%; + height: 6px; + border-radius: theme.border-radius("full"); + align-self: center; +} + +.mobileThemeSwitcher { + display: flex; + flex-flow: row nowrap; + justify-content: space-between; + align-items: center; +} + +.mobileThemeSwitcherFeedback { + display: flex; + flex-flow: row nowrap; + align-items: center; + gap: theme.spacing(3); + text-transform: capitalize; + font-weight: theme.font-weight("medium"); +} diff --git a/apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx b/apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx new file mode 100644 index 0000000000..d6c5048944 --- /dev/null +++ b/apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx @@ -0,0 +1,75 @@ +"use client"; +import { Lifebuoy } from "@phosphor-icons/react/dist/ssr/Lifebuoy"; +import { List } from "@phosphor-icons/react/dist/ssr/List"; +import { X } from "@phosphor-icons/react/dist/ssr/X"; +import { Button } from "@pythnetwork/component-library/Button"; +import clsx from "clsx"; +import { useTheme } from "next-themes"; +import { useState } from "react"; + +import styles from "./mobile-menu.module.scss"; +import { SupportDrawer } from "../Root/support-drawer"; +import { ThemeSwitch } from "../Root/theme-switch"; + +export const MobileMenu = ({ + className, + ...props +}: { + className?: string | string[]; +}) => { + const { theme } = useTheme(); + const [isOpen, setIsOpen] = useState(false); + + const toggleMenu = () => { + setIsOpen(!isOpen); + }; + + return ( +
+ + {isOpen && ( +
+
+
+ + + + +
+
Theme
+
+
{theme}
+ +
+
+ +
+
+ )} +
+ ); +}; diff --git a/apps/insights/src/components/PriceFeeds/index.tsx b/apps/insights/src/components/PriceFeeds/index.tsx index 16691c0844..3a0c9aeeca 100644 --- a/apps/insights/src/components/PriceFeeds/index.tsx +++ b/apps/insights/src/components/PriceFeeds/index.tsx @@ -23,6 +23,7 @@ import { YesterdaysPricesProvider, ChangePercent } from "../ChangePercent"; import { LivePrice } from "../LivePrices"; import { PriceFeedIcon } from "../PriceFeedIcon"; import { PriceFeedTag } from "../PriceFeedTag"; +import { Stats } from "../Stats"; const PRICE_FEEDS_ANCHOR = "priceFeeds"; @@ -48,7 +49,7 @@ export const PriceFeeds = async () => {

Price Feeds

-
+ { corner={} /> -
+ [ @@ -165,32 +166,34 @@ const FeaturedFeedsCard = ({ }: FeaturedFeedsCardProps) => (
- {feeds.map((feed) => ( - -
- } - /> - {showPrices && ( -
- - -
- )} -
-
- ))} + + {feeds.map((feed) => ( + +
+ } + /> + {showPrices && ( +
+ + +
+ )} +
+
+ ))} +
); diff --git a/apps/insights/src/components/Root/footer.module.scss b/apps/insights/src/components/Root/footer.module.scss index f6799a3bf8..979a0c2565 100644 --- a/apps/insights/src/components/Root/footer.module.scss +++ b/apps/insights/src/components/Root/footer.module.scss @@ -7,6 +7,10 @@ // XL padding: theme.spacing(8) 0; + @include theme.mobile { + padding-bottom: theme.spacing(20); + } + // bg-beige-100 sm:border-t sm:border-stone-300 .topContent { @@ -18,10 +22,15 @@ align-items: center; justify-content: space-between; + @media screen and (max-width: theme.breakpoint("sm")) { + flex-flow: column nowrap; + align-items: flex-start; + } + @include theme.max-width; // XL - margin-bottom: theme.spacing(12); + margin-bottom: theme.spacing(6); // py-6 diff --git a/apps/insights/src/components/Root/footer.tsx b/apps/insights/src/components/Root/footer.tsx index 343d49e678..04fa9b773b 100644 --- a/apps/insights/src/components/Root/footer.tsx +++ b/apps/insights/src/components/Root/footer.tsx @@ -1,3 +1,4 @@ +import { ArrowSquareOut } from "@phosphor-icons/react/dist/ssr/ArrowSquareOut"; import { type Props as ButtonProps, Button, @@ -21,10 +22,10 @@ export const Footer = () => (
- Help + Support - Documentation + Documentation
diff --git a/apps/insights/src/components/Root/header.module.scss b/apps/insights/src/components/Root/header.module.scss index 65a3ff8506..6309d5ebde 100644 --- a/apps/insights/src/components/Root/header.module.scss +++ b/apps/insights/src/components/Root/header.module.scss @@ -4,8 +4,11 @@ position: sticky; top: 0; width: 100%; - background-color: theme.color("background", "nav-blur"); - backdrop-filter: blur(32px); + background-color: theme.color("background", "primary"); + border-bottom: 1px solid theme.color("background", "secondary"); + + // TODO: This causes that navigation is not fixed + // backdrop-filter: blur(32px); .content { height: 100%; @@ -16,18 +19,23 @@ .leftMenu { flex: none; - gap: theme.spacing(6); + gap: theme.spacing(4); + position: relative; @include theme.row; .logoLink { padding: theme.spacing(3); - margin: -#{theme.spacing(3)}; color: theme.color("foreground"); + @include theme.desktop { + position: absolute; + left: -#{theme.spacing(16)}; + } + .logoWrapper { - width: theme.spacing(9); - height: theme.spacing(9); + width: theme.spacing(8); + height: theme.spacing(8); position: relative; .logo { @@ -52,33 +60,49 @@ .rightMenu { flex: none; + position: relative; gap: theme.spacing(2); @include theme.row; - margin-right: -#{theme.button-padding("sm", false)}; - .themeSwitch { - margin-left: theme.spacing(1); - } - } + position: relative; - @media screen and (min-width: theme.$max-width + (2 * (theme.spacing(9) + theme.spacing(8) + theme.spacing(7)))) { - .leftMenu { - margin-left: -#{theme.spacing(9) + theme.spacing(7)}; - - .logoLink { - margin-right: -#{theme.spacing(2)}; + @include theme.mobile { + display: none; } - } - .rightMenu { - margin-right: -#{theme.spacing(9) + theme.spacing(7)}; - - .themeSwitch { - margin-left: theme.spacing(5); + @include theme.desktop { + display: block; + position: absolute; + right: -#{theme.spacing(16)}; } } } + + // Reason: you can absolute position relatively to a container and disable this behavior on mobile + // @media screen and (min-width: #{theme.$max-width + (2 * (theme.spacing(9) + theme.spacing(8) + theme.spacing(7)))}) { + // .leftMenu { + // margin-left: -#{theme.spacing(9) + theme.spacing(7)}; + + // .logoLink { + // margin-right: -#{theme.spacing(2)}; + // } + // } + + // .rightMenu { + // margin-right: -#{theme.spacing(9) + theme.spacing(7)}; + + // .themeSwitch { + // margin-left: theme.spacing(5); + // } + // } + // } + } +} + +.hideOnMobile { + @include theme.mobile { + display: none; } } diff --git a/apps/insights/src/components/Root/header.tsx b/apps/insights/src/components/Root/header.tsx index d83d733ccb..c10a9c7fd5 100644 --- a/apps/insights/src/components/Root/header.tsx +++ b/apps/insights/src/components/Root/header.tsx @@ -1,3 +1,5 @@ +"use client"; + import { Lifebuoy } from "@phosphor-icons/react/dist/ssr/Lifebuoy"; import { Button } from "@pythnetwork/component-library/Button"; import { Link } from "@pythnetwork/component-library/Link"; @@ -10,6 +12,7 @@ import { SearchButton } from "./search-button"; import { SupportDrawer } from "./support-drawer"; import { MainNavTabs } from "./tabs"; import { ThemeSwitch } from "./theme-switch"; +import { MobileMenu } from "../MobileMenu/mobile-menu.v2"; export const Header = ({ className, ...props }: ComponentProps<"header">) => (
@@ -25,21 +28,26 @@ export const Header = ({ className, ...props }: ComponentProps<"header">) => (
- - - +
+ + + +
- +
+ +
+
diff --git a/apps/insights/src/components/Root/search-button.tsx b/apps/insights/src/components/Root/search-button.tsx index d099ba7431..0f421acb4f 100644 --- a/apps/insights/src/components/Root/search-button.tsx +++ b/apps/insights/src/components/Root/search-button.tsx @@ -31,7 +31,7 @@ const SearchText = () => { const SearchTextImpl = () => { // This component can only ever render in the client so we can safely ignore // this eslint rule. - // eslint-disable-next-line n/no-unsupported-features/node-builtins + const isMac = useMemo(() => navigator.userAgent.includes("Mac"), []); return isMac ? "⌘ K" : "Ctrl K"; }; diff --git a/apps/insights/src/components/Root/support-drawer.module.scss b/apps/insights/src/components/Root/support-drawer.module.scss index f6152c85d3..9ef4761f9a 100644 --- a/apps/insights/src/components/Root/support-drawer.module.scss +++ b/apps/insights/src/components/Root/support-drawer.module.scss @@ -34,12 +34,12 @@ grid-template-columns: max-content 1fr max-content; grid-template-rows: max-content max-content; text-align: left; - gap: theme.spacing(2) theme.spacing(4); - align-items: center; + gap: theme.spacing(1) theme.spacing(4); + align-items: start; width: 100%; .icon { - font-size: theme.spacing(8); + font-size: theme.spacing(6); color: theme.color("states", "data", "normal"); grid-row: span 2 / span 2; display: grid; @@ -47,17 +47,22 @@ } .header { - @include theme.text("sm", "medium"); + @include theme.h6; + line-height: 1.5; color: theme.color("heading"); } .description { - @include theme.text("xs", "normal"); + @include theme.text("sm", "normal"); + line-height: 1.5; color: theme.color("muted"); grid-column: 2; grid-row: 2; + word-wrap: break-word; + overflow: hidden; + max-width: 100%; } .caret { diff --git a/apps/insights/src/components/Stats/index.module.scss b/apps/insights/src/components/Stats/index.module.scss new file mode 100644 index 0000000000..5ef9f4ffc8 --- /dev/null +++ b/apps/insights/src/components/Stats/index.module.scss @@ -0,0 +1,56 @@ +@use "@pythnetwork/component-library/theme"; + +.statWrapper { + position: relative; + width: 100%; + display: flex; + + @include theme.mobile { + width: 100dvw; // Extend the width beyond the root padding + margin-left: -#{theme.spacing(4)}; + margin-right: -#{theme.spacing(4)}; + white-space: nowrap; + overflow: auto hidden; + -webkit-overflow-scrolling: touch; + scroll-snap-type: x mandatory; + scroll-padding: theme.spacing(4); + left: 0; + right: 0; + + // Optional: Hide scrollbars + scrollbar-width: none; + + &::-webkit-scrollbar { + display: none; + } + } +} + +.statsContainer { + gap: theme.spacing(2); + width: 100%; + display: flex; + flex-flow: row nowrap; + justify-content: space-between; + align-items: center; + + > * { + display: flex; + width: 100%; + flex: 1 0 0; + min-width: 0; + max-width: 100%; + min-height: 0; + } + + @include theme.mobile { + width: max-content; + gap: theme.spacing(3); + padding: 0 theme.spacing(4); + + > * { + width: 280px; + scroll-snap-align: start; + } + } +} diff --git a/apps/insights/src/components/Stats/index.tsx b/apps/insights/src/components/Stats/index.tsx new file mode 100644 index 0000000000..ec040ed115 --- /dev/null +++ b/apps/insights/src/components/Stats/index.tsx @@ -0,0 +1,9 @@ +import styles from "./index.module.scss"; + +export const Stats = ({ children }: { children: React.ReactNode }) => { + return ( +
+
{children}
+
+ ); +}; diff --git a/packages/component-library/src/Button/index.module.scss b/packages/component-library/src/Button/index.module.scss index 6de1e6fc7a..57379baeaa 100644 --- a/packages/component-library/src/Button/index.module.scss +++ b/packages/component-library/src/Button/index.module.scss @@ -1,7 +1,7 @@ @use "../theme"; .button { - display: inline flow-root; + display: flex; cursor: pointer; white-space: nowrap; font-weight: theme.font-weight("medium"); @@ -12,6 +12,9 @@ text-decoration: none; outline-offset: 0; outline: theme.spacing(1) solid transparent; + text-align: center; + justify-content: center; + align-items: center; .iconWrapper { display: inline-grid; diff --git a/packages/component-library/src/Card/index.module.scss b/packages/component-library/src/Card/index.module.scss index 2f127ce2a6..097d0940d7 100644 --- a/packages/component-library/src/Card/index.module.scss +++ b/packages/component-library/src/Card/index.module.scss @@ -16,6 +16,7 @@ position: relative; padding: theme.spacing(1); isolation: isolate; + overflow: hidden; @at-root button#{&} { cursor: pointer; diff --git a/packages/component-library/src/Drawer/index.module.scss b/packages/component-library/src/Drawer/index.module.scss index 3840e4b28e..1b3e7cab62 100644 --- a/packages/component-library/src/Drawer/index.module.scss +++ b/packages/component-library/src/Drawer/index.module.scss @@ -22,6 +22,20 @@ overflow-y: hidden; padding-bottom: theme.border-radius("3xl"); + @include theme.mobile { + width: 100%; + inset: 0; + border-radius: 0; + border: none; + padding-bottom: 0; + + // Remove if we don't want a gap on the top + // Will require to change the animation direction + // top: 5rem; + // border-top-left-radius: theme.border-radius("2xl"); + // border-top-right-radius: theme.border-radius("2xl"); + } + .heading { padding: theme.spacing(4); padding-left: theme.spacing(6); @@ -33,6 +47,11 @@ flex: none; border-bottom: 1px solid theme.color("border"); + @include theme.mobile { + padding: theme.spacing(3); + padding-left: theme.spacing(4); + } + .title { @include theme.h4; @@ -51,8 +70,12 @@ .body { flex: 1; - overflow-y: auto; + overflow: hidden auto; padding: theme.spacing(6); + + @include theme.mobile { + padding: theme.spacing(4); + } } &[data-fill] { diff --git a/packages/component-library/src/Html/base.scss b/packages/component-library/src/Html/base.scss index f4bc030dcc..498fb50698 100644 --- a/packages/component-library/src/Html/base.scss +++ b/packages/component-library/src/Html/base.scss @@ -10,6 +10,10 @@ line-height: 1; } +nextjs-portal { + display: none; +} + html { // We use `scrollbar-gutter: stable` which prevents the page from jumping when // adding or removing the scrollbar. However, react-aria [tries to add a diff --git a/packages/component-library/src/MainNavTabs/index.module.scss b/packages/component-library/src/MainNavTabs/index.module.scss index 0d6e7573ef..121a7afa7c 100644 --- a/packages/component-library/src/MainNavTabs/index.module.scss +++ b/packages/component-library/src/MainNavTabs/index.module.scss @@ -5,10 +5,30 @@ @include theme.row; + @include theme.mobile { + position: fixed; + bottom: 0; + left: 0; + right: 0; + z-index: 900; + padding: 0.5rem; + display: flex; + justify-content: space-between; + align-items: center; + height: 3rem; + border-top: 1px solid theme.color("border"); + background: theme.color("background", "primary"); + } + .tab { position: relative; outline: none; + @include theme.mobile { + flex-grow: 1; + text-align: center; + } + .bubble { position: absolute; inset: 0; diff --git a/packages/component-library/src/SingleToggleGroup/index.module.scss b/packages/component-library/src/SingleToggleGroup/index.module.scss index 5bc1f0d035..64a0400d7d 100644 --- a/packages/component-library/src/SingleToggleGroup/index.module.scss +++ b/packages/component-library/src/SingleToggleGroup/index.module.scss @@ -1,7 +1,7 @@ @use "../theme"; .singleToggleGroup { - gap: theme.spacing(2); + gap: theme.spacing(1); @include theme.row; diff --git a/packages/component-library/src/theme.scss b/packages/component-library/src/theme.scss index 0cfb0b6f9b..0f7d09eb18 100644 --- a/packages/component-library/src/theme.scss +++ b/packages/component-library/src/theme.scss @@ -80,6 +80,38 @@ $border-radius: ( @return map-get-strict($border-radius, $radius); } +$brakpoints: ( + "xs": 480px, + "sm": 720px, + "md": 960px, + "lg": 1024px, + "xl": 1280px, + "2xl": 1536px, + "3xl": 1720px, +); + +@function breakpoint($breakpoint) { + @return map-get-strict($brakpoints, $breakpoint); +} + +@mixin mobile() { + @media screen and (max-width: breakpoint("md")) { + @content; + } +} + +@mixin tablet() { + @media screen and (min-width: breakpoint("md")) { + @content; + } +} + +@mixin desktop() { + @media screen and (min-width: breakpoint("3xl")) { + @content; + } +} + $color-pallette: ( "black": #000, "white": #fff, @@ -726,6 +758,10 @@ $max-width: 96rem; max-width: $max-width; padding: 0 spacing(6); box-sizing: content-box; + + @include mobile { + padding: 0 spacing(4); + } } @mixin row { @@ -784,6 +820,24 @@ $elevations: ( margin: 0; } +@mixin h5 { + font-size: font-size("lg"); + font-style: normal; + font-weight: font-weight("medium"); + line-height: 125%; + letter-spacing: letter-spacing("tight"); + margin: 0; +} + +@mixin h6 { + font-size: font-size("base"); + font-style: normal; + font-weight: font-weight("medium"); + line-height: 125%; + letter-spacing: letter-spacing("tight"); + margin: 0; +} + @mixin text($size: "base", $weight: "normal") { font-size: font-size($size); font-weight: font-weight($weight); From b27e3e41796a3368c8e711ea78081fe08cc19bdf Mon Sep 17 00:00:00 2001 From: PartyParrotGreg <2233348+partyparrotgreg@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:16:06 +0000 Subject: [PATCH 02/13] chore(insights): update .gitignore to include .env*.development files --- apps/insights/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/insights/.gitignore b/apps/insights/.gitignore index 9d2ee2a739..e6fc78b8ba 100644 --- a/apps/insights/.gitignore +++ b/apps/insights/.gitignore @@ -1 +1,2 @@ .env*.local +.env*.development \ No newline at end of file From e938faeb63a085d060cdbe570a0080ab74396e6e Mon Sep 17 00:00:00 2001 From: PartyParrotGreg <2233348+partyparrotgreg@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:41:37 +0000 Subject: [PATCH 03/13] chore(insights): improve footer and drawer styles for better responsiveness and layout adjustments in component library --- .../src/components/Root/footer.module.scss | 39 +-- .../src/Drawer/index.module.scss | 62 ++-- .../src/MainNavTabs/index.module.scss | 36 +- packages/component-library/src/theme.scss | 330 +++++++----------- 4 files changed, 176 insertions(+), 291 deletions(-) diff --git a/apps/insights/src/components/Root/footer.module.scss b/apps/insights/src/components/Root/footer.module.scss index 979a0c2565..fcedc0bfa5 100644 --- a/apps/insights/src/components/Root/footer.module.scss +++ b/apps/insights/src/components/Root/footer.module.scss @@ -2,39 +2,27 @@ .footer { // SM + margin-top: theme.spacing(8); + padding-top: theme.spacing(8); + padding-bottom: theme.spacing(20); background: theme.color("background", "primary"); - // XL - padding: theme.spacing(8) 0; - - @include theme.mobile { - padding-bottom: theme.spacing(20); - } - // bg-beige-100 sm:border-t sm:border-stone-300 .topContent { display: flex; gap: theme.spacing(6); - - // SM - flex-flow: row nowrap; - align-items: center; + flex-flow: column nowrap; + align-items: flex-start; justify-content: space-between; - @media screen and (max-width: theme.breakpoint("sm")) { - flex-flow: column nowrap; - align-items: flex-start; - } - @include theme.max-width; - - // XL margin-bottom: theme.spacing(6); - // py-6 - - // flex-col + @include theme.breakpoint("sm") { + flex-flow: row nowrap; + align-items: center; + } .left { display: flex; @@ -95,10 +83,11 @@ .bottomContent { display: flex; gap: theme.spacing(6); - - // SM - flex-flow: row nowrap; - justify-content: space-between; + flex-flow: column; + @include theme.breakpoint("sm") { + flex-flow: row nowrap; + justify-content: space-between; + } // "flex-col diff --git a/packages/component-library/src/Drawer/index.module.scss b/packages/component-library/src/Drawer/index.module.scss index 1b3e7cab62..bc3fd65f19 100644 --- a/packages/component-library/src/Drawer/index.module.scss +++ b/packages/component-library/src/Drawer/index.module.scss @@ -7,38 +7,34 @@ z-index: 1; .drawer { - position: fixed; - top: theme.spacing(4); - bottom: theme.spacing(4); - right: theme.spacing(4); - width: 60%; - max-width: theme.spacing(160); - outline: none; + width: 100%; + border-radius: 0; + border: none; + padding-bottom: 0; background: theme.color("background", "primary"); - border: 1px solid theme.color("border"); - border-radius: theme.border-radius("3xl"); - display: flex; - flex-flow: column nowrap; - overflow-y: hidden; - padding-bottom: theme.border-radius("3xl"); - @include theme.mobile { - width: 100%; - inset: 0; - border-radius: 0; - border: none; - padding-bottom: 0; - - // Remove if we don't want a gap on the top - // Will require to change the animation direction - // top: 5rem; - // border-top-left-radius: theme.border-radius("2xl"); - // border-top-right-radius: theme.border-radius("2xl"); + @include theme.breakpoint("sm") { + position: fixed; + top: theme.spacing(4); + bottom: theme.spacing(4); + right: theme.spacing(4); + width: 80%; + max-width: theme.spacing(160); + outline: none; + border: 1px solid theme.color("border"); + border-radius: theme.border-radius("3xl"); + display: flex; + flex-flow: column nowrap; + overflow-y: hidden; + padding-bottom: theme.border-radius("3xl"); + } + @include theme.breakpoint("lg") { + width: 60%; } .heading { - padding: theme.spacing(4); - padding-left: theme.spacing(6); + padding: theme.spacing(3); + padding-left: theme.spacing(4); display: flex; flex-flow: row nowrap; justify-content: space-between; @@ -47,9 +43,9 @@ flex: none; border-bottom: 1px solid theme.color("border"); - @include theme.mobile { - padding: theme.spacing(3); - padding-left: theme.spacing(4); + @include theme.breakpoint("sm") { + padding: theme.spacing(4); + padding-left: theme.spacing(6); } .title { @@ -71,10 +67,10 @@ .body { flex: 1; overflow: hidden auto; - padding: theme.spacing(6); + padding: theme.spacing(4); - @include theme.mobile { - padding: theme.spacing(4); + @include theme.breakpoint("sm") { + padding: theme.spacing(6); } } diff --git a/packages/component-library/src/MainNavTabs/index.module.scss b/packages/component-library/src/MainNavTabs/index.module.scss index 121a7afa7c..7941540539 100644 --- a/packages/component-library/src/MainNavTabs/index.module.scss +++ b/packages/component-library/src/MainNavTabs/index.module.scss @@ -1,34 +1,14 @@ @use "../theme"; .mainNavTabs { + isolation: isolate; gap: theme.spacing(2); - @include theme.row; - @include theme.mobile { - position: fixed; - bottom: 0; - left: 0; - right: 0; - z-index: 900; - padding: 0.5rem; - display: flex; - justify-content: space-between; - align-items: center; - height: 3rem; - border-top: 1px solid theme.color("border"); - background: theme.color("background", "primary"); - } - .tab { position: relative; outline: none; - @include theme.mobile { - flex-grow: 1; - text-align: center; - } - .bubble { position: absolute; inset: 0; @@ -59,21 +39,11 @@ pointer-events: auto; &[data-hovered] .bubble { - background-color: theme.color( - "button", - "solid", - "background", - "hover" - ); + background-color: theme.color("button", "solid", "background", "hover"); } &[data-pressed] .bubble { - background-color: theme.color( - "button", - "solid", - "background", - "active" - ); + background-color: theme.color("button", "solid", "background", "active"); } } } diff --git a/packages/component-library/src/theme.scss b/packages/component-library/src/theme.scss index 0f7d09eb18..91735cd2f7 100644 --- a/packages/component-library/src/theme.scss +++ b/packages/component-library/src/theme.scss @@ -23,7 +23,7 @@ $font-weight: ( "semibold": 600, "bold": 700, "extrabold": 800, - "black": 900, + "black": 900 ); @function font-weight($weight) { @@ -44,7 +44,7 @@ $font-size: ( "6xl": 3.75rem, "7xl": 4.5rem, "8xl": 6rem, - "9xl": 8rem, + "9xl": 8rem ); @function font-size($size: "base") { @@ -57,7 +57,7 @@ $letter-spacing: ( "normal": 0em, "wide": 0.025em, "wider": 0.05em, - "widest": 0.1em, + "widest": 0.1em ); @function letter-spacing($spacing: "normal") { @@ -73,42 +73,53 @@ $border-radius: ( "xl": 0.75rem, "2xl": 1rem, "3xl": 1.5rem, - "full": 9999px, + "full": 9999px ); @function border-radius($radius: "base") { @return map-get-strict($border-radius, $radius); } -$brakpoints: ( +$breakpoints: ( "xs": 480px, "sm": 720px, "md": 960px, "lg": 1024px, "xl": 1280px, "2xl": 1536px, - "3xl": 1720px, + "3xl": 1720px ); -@function breakpoint($breakpoint) { - @return map-get-strict($brakpoints, $breakpoint); +@function breakpoint-old($breakpoint) { + @return map-get-strict($breakpoints, $breakpoint); +} + +@mixin breakpoint($point) { + @media (min-width: map-get-strict($breakpoints, $point)) { + @content; + background: lime; + outline: 1px solid purple; + } } @mixin mobile() { - @media screen and (max-width: breakpoint("md")) { + @media screen and (max-width: breakpoint-old("md")) { @content; + background: cyan; } } @mixin tablet() { - @media screen and (min-width: breakpoint("md")) { + @media screen and (min-width: breakpoint-old("md")) { @content; + background: orange; } } @mixin desktop() { - @media screen and (min-width: breakpoint("3xl")) { + @media screen and (min-width: breakpoint-old("3xl")) { @content; + background: pink; } } @@ -126,7 +137,7 @@ $color-pallette: ( 700: #334155, 800: #1e293b, 900: #0f172a, - 950: #020617, + 950: #020617 ), "gray": ( 50: #f9fafb, @@ -139,7 +150,7 @@ $color-pallette: ( 700: #374151, 800: #1f2937, 900: #111827, - 950: #030712, + 950: #030712 ), "zinc": ( 50: #fafafa, @@ -152,7 +163,7 @@ $color-pallette: ( 700: #3f3f46, 800: #27272a, 900: #18181b, - 950: #09090b, + 950: #09090b ), "neutral": ( 50: #fafafa, @@ -165,7 +176,7 @@ $color-pallette: ( 700: #404040, 800: #262626, 900: #171717, - 950: #0a0a0a, + 950: #0a0a0a ), "stone": ( 50: #fafaf9, @@ -178,7 +189,7 @@ $color-pallette: ( 700: #44403c, 800: #292524, 900: #1c1917, - 950: #0c0a09, + 950: #0c0a09 ), "red": ( 50: #fef2f2, @@ -191,7 +202,7 @@ $color-pallette: ( 700: #b91c1c, 800: #991b1b, 900: #7f1d1d, - 950: #450a0a, + 950: #450a0a ), "orange": ( 50: #fff7ed, @@ -204,7 +215,7 @@ $color-pallette: ( 700: #c2410c, 800: #9a3412, 900: #7c2d12, - 950: #431407, + 950: #431407 ), "amber": ( 50: #fffbeb, @@ -217,7 +228,7 @@ $color-pallette: ( 700: #b45309, 800: #92400e, 900: #78350f, - 950: #451a03, + 950: #451a03 ), "yellow": ( 50: #fefce8, @@ -230,7 +241,7 @@ $color-pallette: ( 700: #a16207, 800: #854d0e, 900: #713f12, - 950: #422006, + 950: #422006 ), "lime": ( 50: #f7fee7, @@ -243,7 +254,7 @@ $color-pallette: ( 700: #4d7c0f, 800: #3f6212, 900: #365314, - 950: #1a2e05, + 950: #1a2e05 ), "green": ( 50: #f0fdf4, @@ -256,7 +267,7 @@ $color-pallette: ( 700: #15803d, 800: #166534, 900: #14532d, - 950: #052e16, + 950: #052e16 ), "emerald": ( 50: #ecfdf5, @@ -269,7 +280,7 @@ $color-pallette: ( 700: #047857, 800: #065f46, 900: #064e3b, - 950: #022c22, + 950: #022c22 ), "teal": ( 50: #f0fdfa, @@ -282,7 +293,7 @@ $color-pallette: ( 700: #0f766e, 800: #115e59, 900: #134e4a, - 950: #042f2e, + 950: #042f2e ), "cyan": ( 50: #ecfeff, @@ -295,7 +306,7 @@ $color-pallette: ( 700: #0e7490, 800: #155e75, 900: #164e63, - 950: #083344, + 950: #083344 ), "sky": ( 50: #f0f9ff, @@ -308,7 +319,7 @@ $color-pallette: ( 700: #0369a1, 800: #075985, 900: #0c4a6e, - 950: #082f49, + 950: #082f49 ), "blue": ( 50: #eff6ff, @@ -321,7 +332,7 @@ $color-pallette: ( 700: #1d4ed8, 800: #1e40af, 900: #1e3a8a, - 950: #172554, + 950: #172554 ), "indigo": ( 50: #eef2ff, @@ -334,7 +345,7 @@ $color-pallette: ( 700: #4338ca, 800: #3730a3, 900: #312e81, - 950: #1e1b4b, + 950: #1e1b4b ), "violet": ( 50: #f5f3ff, @@ -347,7 +358,7 @@ $color-pallette: ( 700: #6d28d9, 800: #5b21b6, 900: #4c1d95, - 950: #2e1065, + 950: #2e1065 ), "purple": ( 50: #faf5ff, @@ -360,7 +371,7 @@ $color-pallette: ( 700: #7e22ce, 800: #6b21a8, 900: #581c87, - 950: #3b0764, + 950: #3b0764 ), "fuchsia": ( 50: #fdf4ff, @@ -373,7 +384,7 @@ $color-pallette: ( 700: #a21caf, 800: #86198f, 900: #701a75, - 950: #4a044e, + 950: #4a044e ), "pink": ( 50: #fdf2f8, @@ -386,7 +397,7 @@ $color-pallette: ( 700: #be185d, 800: #9d174d, 900: #831843, - 950: #500724, + 950: #500724 ), "rose": ( 50: #fff1f2, @@ -399,7 +410,7 @@ $color-pallette: ( 700: #be123c, 800: #9f1239, 900: #881337, - 950: #4c0519, + 950: #4c0519 ), "beige": ( 50: #f7f4f4, @@ -412,7 +423,7 @@ $color-pallette: ( 700: #795c5c, 800: #664e4e, 900: #574545, - 950: #2d2222, + 950: #2d2222 ), "steel": ( 50: #f8f9fc, @@ -425,8 +436,8 @@ $color-pallette: ( 700: #333655, 800: #25253e, 900: #27253d, - 950: #100e23, - ), + 950: #100e23 + ) ); @function pallette-color($color...) { @@ -438,198 +449,123 @@ $color: ( "background": ( "primary": light-dark(pallette-color("white"), pallette-color("steel", 950)), "nav-blur": - light-dark( - rgb(from pallette-color("white") r g b / 70%), - rgb(from pallette-color("steel", 950) r g b / 70%) - ), + light-dark(rgb(from pallette-color("white") r g b / 70%), rgb(from pallette-color("steel", 950) r g b / 70%)), "modal": light-dark(pallette-color("white"), pallette-color("steel", 950)), - "secondary": - light-dark(pallette-color("beige", 100), pallette-color("steel", 900)), - "card-highlight": - light-dark(pallette-color("violet", 100), pallette-color("violet", 950)), - "card-secondary": - light-dark(pallette-color("white"), pallette-color("steel", 950)), - ), - "foreground": - light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), - "heading": - light-dark(pallette-color("steel", 800), pallette-color("steel", 200)), - "paragraph": - light-dark(pallette-color("steel", 700), pallette-color("steel", 300)), + "secondary": light-dark(pallette-color("beige", 100), pallette-color("steel", 900)), + "card-highlight": light-dark(pallette-color("violet", 100), pallette-color("violet", 950)), + "card-secondary": light-dark(pallette-color("white"), pallette-color("steel", 950)) + ), + "foreground": light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), + "heading": light-dark(pallette-color("steel", 800), pallette-color("steel", 200)), + "paragraph": light-dark(pallette-color("steel", 700), pallette-color("steel", 300)), "link": ( - "primary": - light-dark(pallette-color("violet", 700), pallette-color("purple", 300)), - "normal": - light-dark(pallette-color("steel", 800), pallette-color("steel", 50)), - ), - "highlight": - light-dark(pallette-color("violet", 600), pallette-color("violet", 500)), - "muted": - light-dark(pallette-color("stone", 700), pallette-color("steel", 300)), - "border": - light-dark(pallette-color("stone", 300), pallette-color("steel", 600)), + "primary": light-dark(pallette-color("violet", 700), pallette-color("purple", 300)), + "normal": light-dark(pallette-color("steel", 800), pallette-color("steel", 50)) + ), + "highlight": light-dark(pallette-color("violet", 600), pallette-color("violet", 500)), + "muted": light-dark(pallette-color("stone", 700), pallette-color("steel", 300)), + "border": light-dark(pallette-color("stone", 300), pallette-color("steel", 600)), "selection": ( - "background": - light-dark(pallette-color("violet", 600), pallette-color("violet", 400)), - "foreground": - light-dark(pallette-color("steel", 50), pallette-color("steel", 950)), + "background": light-dark(pallette-color("violet", 600), pallette-color("violet", 400)), + "foreground": light-dark(pallette-color("steel", 50), pallette-color("steel", 950)) ), "states": ( "success": ( - "base": - light-dark( - pallette-color("emerald", 600), - pallette-color("emerald", 500) - ), - "background": - light-dark( - pallette-color("emerald", 100), - pallette-color("emerald", 950) - ), - "normal": - light-dark( - pallette-color("emerald", 600), - pallette-color("emerald", 500) - ), + "base": light-dark(pallette-color("emerald", 600), pallette-color("emerald", 500)), + "background": light-dark(pallette-color("emerald", 100), pallette-color("emerald", 950)), + "normal": light-dark(pallette-color("emerald", 600), pallette-color("emerald", 500)), "hover": pallette-color("emerald", 700), "active": pallette-color("emerald", 800), - "border": - light-dark( - pallette-color("emerald", 400), - pallette-color("emerald", 800) - ), + "border": light-dark(pallette-color("emerald", 400), pallette-color("emerald", 800)) ), "error": ( "base": light-dark(pallette-color("red", 600), pallette-color("red", 400)), - "color": - light-dark(pallette-color("red", 500), pallette-color("red", 400)), - "background": - light-dark(pallette-color("red", 100), pallette-color("red", 950)), + "color": light-dark(pallette-color("red", 500), pallette-color("red", 400)), + "background": light-dark(pallette-color("red", 100), pallette-color("red", 950)), "normal": pallette-color("red", 500), "hover": pallette-color("red", 600), "active": pallette-color("red", 700), - "border": - light-dark(pallette-color("red", 400), pallette-color("red", 900)), + "border": light-dark(pallette-color("red", 400), pallette-color("red", 900)) ), "neutral": ( - "normal": - light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), - "border": - light-dark(pallette-color("stone", 300), pallette-color("steel", 600)), - "background": - light-dark(pallette-color("white"), pallette-color("steel", 900)), + "normal": light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), + "border": light-dark(pallette-color("stone", 300), pallette-color("steel", 600)), + "background": light-dark(pallette-color("white"), pallette-color("steel", 900)) ), "info": ( - "background": - light-dark(pallette-color("indigo", 100), pallette-color("indigo", 950)), + "background": light-dark(pallette-color("indigo", 100), pallette-color("indigo", 950)), "background-opaque": light-dark( rgb(from pallette-color("indigo", 200) r g b / 80%), rgb(from pallette-color("indigo", 950) r g b / 80%) ), - "icon": - light-dark(pallette-color("indigo", 600), pallette-color("indigo", 500)), - "normal": - light-dark(pallette-color("indigo", 600), pallette-color("indigo", 400)), - "border": - light-dark(pallette-color("indigo", 400), pallette-color("indigo", 800)), + "icon": light-dark(pallette-color("indigo", 600), pallette-color("indigo", 500)), + "normal": light-dark(pallette-color("indigo", 600), pallette-color("indigo", 400)), + "border": light-dark(pallette-color("indigo", 400), pallette-color("indigo", 800)) ), "warning": ( - "normal": - light-dark(pallette-color("orange", 600), pallette-color("orange", 400)), - "background": - light-dark(pallette-color("orange", 100), pallette-color("orange", 950)), - "border": - light-dark(pallette-color("orange", 400), pallette-color("orange", 700)), + "normal": light-dark(pallette-color("orange", 600), pallette-color("orange", 400)), + "background": light-dark(pallette-color("orange", 100), pallette-color("orange", 950)), + "border": light-dark(pallette-color("orange", 400), pallette-color("orange", 700)) ), "yellow": ( "normal": pallette-color("yellow", 500), - "background": - light-dark(pallette-color("yellow", 100), pallette-color("yellow", 900)), + "background": light-dark(pallette-color("yellow", 100), pallette-color("yellow", 900)) ), "lime": ( "normal": pallette-color("lime", 500), - "background": - light-dark(pallette-color("lime", 100), pallette-color("lime", 900)), + "background": light-dark(pallette-color("lime", 100), pallette-color("lime", 900)) ), "data": ( - "normal": - light-dark(pallette-color("violet", 600), pallette-color("violet", 400)), - "background": - light-dark(pallette-color("violet", 100), pallette-color("violet", 950)), - "border": - light-dark(pallette-color("violet", 200), pallette-color("violet", 800)), - ), + "normal": light-dark(pallette-color("violet", 600), pallette-color("violet", 400)), + "background": light-dark(pallette-color("violet", 100), pallette-color("violet", 950)), + "border": light-dark(pallette-color("violet", 200), pallette-color("violet", 800)) + ) ), - "focus": - light-dark(pallette-color("violet", 700), pallette-color("violet", 500)), + "focus": light-dark(pallette-color("violet", 700), pallette-color("violet", 500)), "focus-dim": - light-dark( - rgb(from pallette-color("violet", 700) r g b / 30%), - rgb(from pallette-color("violet", 500) r g b / 30%) - ), + light-dark(rgb(from pallette-color("violet", 700) r g b / 30%), rgb(from pallette-color("violet", 500) r g b / 30%)), "forms": ( "input": ( "hover": ( - "border": - light-dark(pallette-color("stone", 400), pallette-color("steel", 500)), - ), - ), + "border": light-dark(pallette-color("stone", 400), pallette-color("steel", 500)) + ) + ) ), "chart": ( "series": ( - "primary": - light-dark(pallette-color("violet", 500), pallette-color("violet", 400)), - "neutral": - light-dark(pallette-color("stone", 500), pallette-color("steel", 300)), - ), + "primary": light-dark(pallette-color("violet", 500), pallette-color("violet", 400)), + "neutral": light-dark(pallette-color("stone", 500), pallette-color("steel", 300)) + ) ), "button": ( "primary": ( "foreground": pallette-color("white"), "background": ( - "normal": - light-dark( - pallette-color("violet", 700), - pallette-color("violet", 600) - ), - "hover": - light-dark( - pallette-color("violet", 800), - pallette-color("violet", 700) - ), - "active": - light-dark( - pallette-color("violet", 900), - pallette-color("violet", 800) - ), - ), + "normal": light-dark(pallette-color("violet", 700), pallette-color("violet", 600)), + "hover": light-dark(pallette-color("violet", 800), pallette-color("violet", 700)), + "active": light-dark(pallette-color("violet", 900), pallette-color("violet", 800)) + ) ), "secondary": ( "foreground": pallette-color("steel", 900), "background": ( "normal": pallette-color("purple", 200), "hover": pallette-color("purple", 300), - "active": pallette-color("purple", 400), - ), + "active": pallette-color("purple", 400) + ) ), "solid": ( - "foreground": - light-dark(pallette-color("steel", 50), pallette-color("steel", 900)), + "foreground": light-dark(pallette-color("steel", 50), pallette-color("steel", 900)), "background": ( - "normal": - light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), - "hover": - light-dark(pallette-color("steel", 600), pallette-color("steel", 200)), - "active": - light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), - ), + "normal": light-dark(pallette-color("steel", 900), pallette-color("steel", 50)), + "hover": light-dark(pallette-color("steel", 600), pallette-color("steel", 200)), + "active": light-dark(pallette-color("steel", 900), pallette-color("steel", 50)) + ) ), "outline": ( - "border": - light-dark(pallette-color("stone", 300), pallette-color("steel", 600)), - "foreground": - light-dark(pallette-color("stone", 900), pallette-color("steel", 50)), + "border": light-dark(pallette-color("stone", 300), pallette-color("steel", 600)), + "foreground": light-dark(pallette-color("stone", 900), pallette-color("steel", 50)), "background": ( "hover": light-dark( @@ -640,16 +576,14 @@ $color: ( light-dark( rgb(from pallette-color("beige", 950) r g b / 10%), rgb(from pallette-color("steel", 50) r g b / 10%) - ), - ), + ) + ) ), "disabled": ( - "foreground": - light-dark(pallette-color("stone", 400), pallette-color("steel", 400)), - "background": - light-dark(pallette-color("stone", 200), pallette-color("steel", 600)), - ), - ), + "foreground": light-dark(pallette-color("stone", 400), pallette-color("steel", 400)), + "background": light-dark(pallette-color("stone", 200), pallette-color("steel", 600)) + ) + ) ); @function color($color-path...) { @@ -663,7 +597,7 @@ $button-sizes: ( "border-radius": border-radius("md"), "font-size": font-size("xxs"), "icon-size": spacing(4), - "gap": spacing(1), + "gap": spacing(1) ), "sm": ( "padding": spacing(2), @@ -671,7 +605,7 @@ $button-sizes: ( "border-radius": border-radius("lg"), "font-size": font-size("sm"), "icon-size": spacing(5), - "gap": spacing(2), + "gap": spacing(2) ), "md": ( "padding": spacing(3), @@ -679,7 +613,7 @@ $button-sizes: ( "border-radius": border-radius("xl"), "font-size": font-size("base"), "icon-size": spacing(6), - "gap": spacing(2), + "gap": spacing(2) ), "lg": ( "padding": spacing(4), @@ -687,8 +621,8 @@ $button-sizes: ( "border-radius": border-radius("2xl"), "font-size": font-size("xl"), "icon-size": spacing(6), - "gap": spacing(3), - ), + "gap": spacing(3) + ) ); @function button-padding($size, $include-gap) { @@ -756,11 +690,11 @@ $max-width: 96rem; @mixin max-width { margin: 0 auto; max-width: $max-width; - padding: 0 spacing(6); + padding: 0 spacing(4); box-sizing: content-box; - @include mobile { - padding: 0 spacing(4); + @include breakpoint("xl") { + padding: 0 spacing(6); } } @@ -777,25 +711,21 @@ $elevations: ( 0px 42px 17px 0px rgb(112 66 206 / 3%), 0px 24px 14px 0px rgb(112 66 206 / 8%), 0px 11px 11px 0px rgb(112 66 206 / 14%), - 0px 3px 6px 0px rgb(112 66 206 / 17%), - ), + 0px 3px 6px 0px rgb(112 66 206 / 17%) + ) ), default: ( 1: ( 0px 4px 6px -4px rgb(from black r g b / 10%), - 0px 10px 15px -3px rgb(from black r g b / 10%), + 0px 10px 15px -3px rgb(from black r g b / 10%) ), 2: ( - 0px 29px 12px 0px - light-dark(rgb(from #564848 r g b / 2%), rgb(from black r g b / 8%)), - 0px 16px 10px 0px - light-dark(rgb(from #564848 r g b / 6%), rgb(from black r g b / 12%)), - 0px 7px 7px 0px - light-dark(rgb(from #564848 r g b / 12%), rgb(from black r g b / 20%)), - 0px 2px 4px 0px - light-dark(rgb(from #564848 r g b / 14%), rgb(from black r g b / 30%)), - ), - ), + 0px 29px 12px 0px light-dark(rgb(from #564848 r g b / 2%), rgb(from black r g b / 8%)), + 0px 16px 10px 0px light-dark(rgb(from #564848 r g b / 6%), rgb(from black r g b / 12%)), + 0px 7px 7px 0px light-dark(rgb(from #564848 r g b / 12%), rgb(from black r g b / 20%)), + 0px 2px 4px 0px light-dark(rgb(from #564848 r g b / 14%), rgb(from black r g b / 30%)) + ) + ) ); @mixin elevation($elevation...) { From 8b3765324f59d16ea4d4a1dc293f1e02d2232332 Mon Sep 17 00:00:00 2001 From: PartyParrotGreg <2233348+partyparrotgreg@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:45:28 +0000 Subject: [PATCH 04/13] chore(insights): refine header styles for better layout and responsiveness across breakpoints in the insights component --- .../src/components/Root/header.module.scss | 42 ++++++------------- apps/insights/src/components/Root/header.tsx | 8 ++-- 2 files changed, 18 insertions(+), 32 deletions(-) diff --git a/apps/insights/src/components/Root/header.module.scss b/apps/insights/src/components/Root/header.module.scss index 6309d5ebde..60f42bcfb1 100644 --- a/apps/insights/src/components/Root/header.module.scss +++ b/apps/insights/src/components/Root/header.module.scss @@ -27,8 +27,8 @@ .logoLink { padding: theme.spacing(3); color: theme.color("foreground"); - - @include theme.desktop { + position: relative; + @include theme.breakpoint("3xl") { position: absolute; left: -#{theme.spacing(16)}; } @@ -66,43 +66,27 @@ @include theme.row; .themeSwitch { - position: relative; + display: none; - @include theme.mobile { - display: none; + @include theme.breakpoint("md") { + position: relative; + display: block; } - @include theme.desktop { + @include theme.breakpoint("3xl") { display: block; position: absolute; right: -#{theme.spacing(16)}; } } } - - // Reason: you can absolute position relatively to a container and disable this behavior on mobile - // @media screen and (min-width: #{theme.$max-width + (2 * (theme.spacing(9) + theme.spacing(8) + theme.spacing(7)))}) { - // .leftMenu { - // margin-left: -#{theme.spacing(9) + theme.spacing(7)}; - - // .logoLink { - // margin-right: -#{theme.spacing(2)}; - // } - // } - - // .rightMenu { - // margin-right: -#{theme.spacing(9) + theme.spacing(7)}; - - // .themeSwitch { - // margin-left: theme.spacing(5); - // } - // } - // } } -} - -.hideOnMobile { - @include theme.mobile { + .desktopNavigation, + .desktopSupport, + .desktopDocs { display: none; + @include theme.breakpoint("md") { + display: block; + } } } diff --git a/apps/insights/src/components/Root/header.tsx b/apps/insights/src/components/Root/header.tsx index c10a9c7fd5..e7baebaa7d 100644 --- a/apps/insights/src/components/Root/header.tsx +++ b/apps/insights/src/components/Root/header.tsx @@ -25,10 +25,12 @@ export const Header = ({ className, ...props }: ComponentProps<"header">) => (
Pyth Homepage
Insights
- +
+ +
-
+
-
+
+
+ ); +}; diff --git a/apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx b/apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx deleted file mode 100644 index d6c5048944..0000000000 --- a/apps/insights/src/components/MobileMenu/mobile-menu.v2.tsx +++ /dev/null @@ -1,75 +0,0 @@ -"use client"; -import { Lifebuoy } from "@phosphor-icons/react/dist/ssr/Lifebuoy"; -import { List } from "@phosphor-icons/react/dist/ssr/List"; -import { X } from "@phosphor-icons/react/dist/ssr/X"; -import { Button } from "@pythnetwork/component-library/Button"; -import clsx from "clsx"; -import { useTheme } from "next-themes"; -import { useState } from "react"; - -import styles from "./mobile-menu.module.scss"; -import { SupportDrawer } from "../Root/support-drawer"; -import { ThemeSwitch } from "../Root/theme-switch"; - -export const MobileMenu = ({ - className, - ...props -}: { - className?: string | string[]; -}) => { - const { theme } = useTheme(); - const [isOpen, setIsOpen] = useState(false); - - const toggleMenu = () => { - setIsOpen(!isOpen); - }; - - return ( -
- - {isOpen && ( -
-
-
- - - - -
-
Theme
-
-
{theme}
- -
-
- -
-
- )} -
- ); -}; diff --git a/apps/insights/src/components/MobileNavigation/mobile-navigation.module.scss b/apps/insights/src/components/MobileNavigation/mobile-navigation.module.scss new file mode 100644 index 0000000000..6710b50b8c --- /dev/null +++ b/apps/insights/src/components/MobileNavigation/mobile-navigation.module.scss @@ -0,0 +1,11 @@ +@use "@pythnetwork/component-library/theme"; + +.mobileNavigation { + display: block; + padding: theme.spacing(2); + background: theme.color("background", "primary"); + border-top: 1px solid theme.color("background", "secondary"); + @include theme.breakpoint("md") { + display: none; + } +} diff --git a/apps/insights/src/components/MobileNavigation/mobile-navigation.tsx b/apps/insights/src/components/MobileNavigation/mobile-navigation.tsx new file mode 100644 index 0000000000..ebaa4915cb --- /dev/null +++ b/apps/insights/src/components/MobileNavigation/mobile-navigation.tsx @@ -0,0 +1,9 @@ +import styles from "./mobile-navigation.module.scss" +import { MainNavTabs } from "../Root/tabs" +export const MobileNavigation = () => { + return ( +
+ +
+ ) +} \ No newline at end of file diff --git a/apps/insights/src/components/Root/footer.module.scss b/apps/insights/src/components/Root/footer.module.scss index fcedc0bfa5..e0164772b1 100644 --- a/apps/insights/src/components/Root/footer.module.scss +++ b/apps/insights/src/components/Root/footer.module.scss @@ -3,12 +3,9 @@ .footer { // SM margin-top: theme.spacing(8); - padding-top: theme.spacing(8); - padding-bottom: theme.spacing(20); + padding: theme.spacing(8) 0; background: theme.color("background", "primary"); - // bg-beige-100 sm:border-t sm:border-stone-300 - .topContent { display: flex; gap: theme.spacing(6); @@ -28,12 +25,8 @@ display: flex; align-items: stretch; justify-content: space-between; - - // SM gap: theme.spacing(6); - // gap-8 - .logoLink { height: theme.spacing(5); box-sizing: content-box; diff --git a/apps/insights/src/components/Root/header.tsx b/apps/insights/src/components/Root/header.tsx index e7baebaa7d..d1f54e6294 100644 --- a/apps/insights/src/components/Root/header.tsx +++ b/apps/insights/src/components/Root/header.tsx @@ -12,7 +12,7 @@ import { SearchButton } from "./search-button"; import { SupportDrawer } from "./support-drawer"; import { MainNavTabs } from "./tabs"; import { ThemeSwitch } from "./theme-switch"; -import { MobileMenu } from "../MobileMenu/mobile-menu.v2"; +import { MobileMenu } from "../MobileMenu/mobile-menu"; export const Header = ({ className, ...props }: ComponentProps<"header">) => (
diff --git a/apps/insights/src/components/Root/index.tsx b/apps/insights/src/components/Root/index.tsx index e3fb96107d..b2fd1e2a88 100644 --- a/apps/insights/src/components/Root/index.tsx +++ b/apps/insights/src/components/Root/index.tsx @@ -18,6 +18,7 @@ import { toHex } from "../../hex"; import { getPublishers } from "../../services/clickhouse"; import { Cluster, getData } from "../../services/pyth"; import { LivePricesProvider } from "../LivePrices"; +import { MobileNavigation } from "../MobileNavigation/mobile-navigation"; import { PriceFeedIcon } from "../PriceFeedIcon"; import { PublisherIcon } from "../PublisherIcon"; @@ -65,6 +66,7 @@ export const Root = async ({ children }: Props) => { {children}