diff --git a/apps/_components/src/Footer/Footer.module.css b/apps/_components/src/Footer/Footer.module.css index b70659b719..cecb919a45 100644 --- a/apps/_components/src/Footer/Footer.module.css +++ b/apps/_components/src/Footer/Footer.module.css @@ -1,5 +1,6 @@ .footer { background-color: var(--ds-color-neutral-background-subtle); + border-top: 1px solid var(--ds-color-neutral-border-default); } .container { diff --git a/apps/_components/src/Header/Header.module.css b/apps/_components/src/Header/Header.module.css index b1bdc39d7b..22f4fc7911 100644 --- a/apps/_components/src/Header/Header.module.css +++ b/apps/_components/src/Header/Header.module.css @@ -4,7 +4,12 @@ align-items: center; position: relative; z-index: 5; - background-color: white; + background-color: var(--ds-color-neutral-background-default); + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-background-subtle); + } } .container { @@ -15,6 +20,14 @@ padding: 0 var(--ds-spacing-8); } +.container nav { + display: flex; +} + +.container nav button { + height: fit-content; +} + .logoContainer { display: flex; align-items: center; @@ -26,13 +39,17 @@ width: auto; } +.logoLink svg [data-text] { + fill: var(--ds-color-neutral-text-default); +} + .logoLink { display: flex; align-items: center; } .tag { - background-color: #f2d6ff; + background-color: var(--ds-global-purple-5); border-radius: 4px; padding: 7px 10px; font-size: 18px; @@ -40,9 +57,9 @@ } .toggle { - display: none; + display: flex; border: none; - background-color: transparent; + place-self: flex-end; } .menu { @@ -50,7 +67,7 @@ margin: 0; padding: 0; max-width: 100%; - align-items: flex-start; + align-items: center; } .item { @@ -120,18 +137,18 @@ height: 72px; } - .toggle { - display: block; + & nav { + gap: var(--ds-spacing-1); } .menu { - border-top: 1px solid #e2e2e2; + border-top: 1px solid var(--ds-color-neutral-border-subtle); position: absolute; z-index: 1; left: 0; right: 0; - top: 71px; - background-color: white; + top: 75px; + background-color: var(--ds-color-neutral-background-default); box-shadow: var(--ds-shadow-lg); flex-direction: column; display: none; @@ -161,48 +178,6 @@ } } -@media (max-width: 900px) { - &.header { - height: 72px; - } - - .toggle { - display: block; - } - - .menu { - border-top: 1px solid #e2e2e2; - position: absolute; - z-index: 1; - left: 0; - right: 0; - top: 71px; - background-color: white; - box-shadow: var(--ds-shadow-lg); - flex-direction: column; - display: none; - padding: 20px 0; - width: 100%; - } - - .item { - padding: 20px 0; - margin-left: 16px; - } - - .active { - display: block; - } - - .item .active { - display: inline-block; - } - - .linkIcon { - place-items: start; - } - - .logo { - height: 26px; - } +.toggleButton svg { + font-size: 1.75em; } diff --git a/apps/_components/src/Header/Header.tsx b/apps/_components/src/Header/Header.tsx index 9d6dd2202f..f1c2c1ba5d 100644 --- a/apps/_components/src/Header/Header.tsx +++ b/apps/_components/src/Header/Header.tsx @@ -1,6 +1,16 @@ 'use client'; -import { Paragraph, SkipLink } from '@digdir/designsystemet-react'; -import { MenuHamburgerIcon, XMarkIcon } from '@navikt/aksel-icons'; +import { + Button, + Paragraph, + SkipLink, + Tooltip, +} from '@digdir/designsystemet-react'; +import { + MenuHamburgerIcon, + MoonIcon, + SunIcon, + XMarkIcon, +} from '@navikt/aksel-icons'; import cl from 'clsx/lite'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; @@ -15,6 +25,7 @@ type HeaderProps = { menu: { name: string; href: string }[]; betaTag?: boolean; skipLink?: boolean; + themeSwitcher?: boolean; }; /** @@ -47,13 +58,35 @@ const detectWrap = (items: HTMLCollection) => { /** * Only works in next.js projects */ -const Header = ({ menu, betaTag, skipLink = true }: HeaderProps) => { +const Header = ({ + menu, + betaTag, + skipLink = true, + themeSwitcher = false, +}: HeaderProps) => { const [open, setOpen] = useState(false); const [isHamburger, setIsHamburger] = useState(false); const menuRef = useRef(null); const headerRef = useRef(null); const pathname = usePathname(); + const [theme, setTheme] = useState('light'); + + const handleThemeChange = (newTheme: 'dark' | 'light') => { + setTheme(newTheme); + document.documentElement.setAttribute('data-ds-color-mode', newTheme); + }; + + useEffect(() => { + if (!themeSwitcher) return; + // get user preference + const userPreference = window.matchMedia('(prefers-color-scheme: dark)'); + const userPrefersDark = userPreference.matches; + + // set theme based on user preference + handleThemeChange(userPrefersDark ? 'dark' : 'light'); + }, []); + useEffect(() => { const handleResize = () => { if (isHamburger) return; @@ -91,17 +124,32 @@ const Header = ({ menu, betaTag, skipLink = true }: HeaderProps) => { {betaTag &&
Beta
} diff --git a/apps/_components/src/Header/logos/ds-logo.tsx b/apps/_components/src/Header/logos/ds-logo.tsx index 379af65f42..9904137157 100644 --- a/apps/_components/src/Header/logos/ds-logo.tsx +++ b/apps/_components/src/Header/logos/ds-logo.tsx @@ -11,8 +11,9 @@ export const DsLogo = ({ ...props }: DsLogoProps) => { {...props} > diff --git a/apps/storefront/app/bloggen/_components/Card/BlogCard.module.css b/apps/storefront/app/bloggen/_components/Card/BlogCard.module.css index d70a211e00..2e139e16a6 100644 --- a/apps/storefront/app/bloggen/_components/Card/BlogCard.module.css +++ b/apps/storefront/app/bloggen/_components/Card/BlogCard.module.css @@ -16,6 +16,13 @@ } } +.card { + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + --dsc-card-background: var(--ds-color-neutral-surface-default); + } +} + .tag { margin-bottom: 11px; padding: 3px 9px; diff --git a/apps/storefront/app/bloggen/_components/Contributors/Contributors.module.css b/apps/storefront/app/bloggen/_components/Contributors/Contributors.module.css index 297ca1f43b..acfb335aef 100644 --- a/apps/storefront/app/bloggen/_components/Contributors/Contributors.module.css +++ b/apps/storefront/app/bloggen/_components/Contributors/Contributors.module.css @@ -30,7 +30,7 @@ top: calc(var(--height) / -2); left: 50%; transform: translateX(-50%); - background-color: white; + background-color: var(--ds-color-neutral-background-default); } .logo .logoImage { diff --git a/apps/storefront/app/bloggen/_components/PostLayout/PostLayout.tsx b/apps/storefront/app/bloggen/_components/PostLayout/PostLayout.tsx index 991902b447..07cf0b1618 100644 --- a/apps/storefront/app/bloggen/_components/PostLayout/PostLayout.tsx +++ b/apps/storefront/app/bloggen/_components/PostLayout/PostLayout.tsx @@ -48,7 +48,9 @@ function PostLayout({ ))}
- {heading} + + {heading} + {ingress} @@ -84,6 +86,16 @@ function PostLayout({
+ ); } diff --git a/apps/storefront/app/komponenter/page.tsx b/apps/storefront/app/komponenter/page.tsx index 8a2188dbf0..51f875742f 100644 --- a/apps/storefront/app/komponenter/page.tsx +++ b/apps/storefront/app/komponenter/page.tsx @@ -26,6 +26,11 @@ export default function page() { {` body { background-color: var(--ds-color-neutral-background-subtle); + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-background-default); + } } `} diff --git a/apps/storefront/app/layout.tsx b/apps/storefront/app/layout.tsx index c32582e3b7..beb7f1c0e0 100644 --- a/apps/storefront/app/layout.tsx +++ b/apps/storefront/app/layout.tsx @@ -99,12 +99,12 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( - +
Hopp til hovedinnhold -
+
{children}
{process.env.VERCEL_ENV === 'production' && ( diff --git a/apps/storefront/components/Banner/Banner.module.css b/apps/storefront/components/Banner/Banner.module.css index 95fc8c26ef..19b86704fb 100644 --- a/apps/storefront/components/Banner/Banner.module.css +++ b/apps/storefront/components/Banner/Banner.module.css @@ -9,8 +9,13 @@ align-items: center; flex-wrap: wrap; flex-direction: column; - background-color: white; + background-color: var(--ds-color-neutral-background-default); gap: var(--ds-spacing-4); + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-background-subtle); + } } .ingress { diff --git a/apps/storefront/components/ComponentCard/ComponentCard.module.css b/apps/storefront/components/ComponentCard/ComponentCard.module.css index cb36a76aee..96d1a5cc60 100644 --- a/apps/storefront/components/ComponentCard/ComponentCard.module.css +++ b/apps/storefront/components/ComponentCard/ComponentCard.module.css @@ -1,13 +1,18 @@ .card { display: block; text-align: center; - background-color: white; + background-color: var(--ds-color-neutral-background-default); color: var(--ds-color-neutral-text-default); padding: var(--ds-spacing-10); border-radius: var(--ds-border-radius-md); box-shadow: var(--ds-shadow-xs); text-decoration: none; transition: 0.2s transform ease-in-out, 0.2s box-shadow ease-in-out; + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-surface-default); + } } .card:hover { diff --git a/apps/storefront/components/GithubLink/GithubLink.module.css b/apps/storefront/components/GithubLink/GithubLink.module.css new file mode 100644 index 0000000000..0a0e07c5b5 --- /dev/null +++ b/apps/storefront/components/GithubLink/GithubLink.module.css @@ -0,0 +1,3 @@ +.githubLink path { + fill: var(--ds-color-neutral-text-default); +} diff --git a/apps/storefront/components/GithubLink/GithubLink.tsx b/apps/storefront/components/GithubLink/GithubLink.tsx index f59a4dd0ac..a1d8ae6e71 100644 --- a/apps/storefront/components/GithubLink/GithubLink.tsx +++ b/apps/storefront/components/GithubLink/GithubLink.tsx @@ -4,7 +4,11 @@ import { Github } from '@repo/components'; import { usePathname } from 'next/navigation'; import type { HTMLAttributes } from 'react'; +import cl from 'clsx/lite'; +import classes from './GithubLink.module.css'; + const GithubLink = ({ + className, ...rest }: Omit, 'color'>) => { const pathName = usePathname(); @@ -17,6 +21,7 @@ const GithubLink = ({ rel='noopener noreferrer' {...rest} data-unstyled + className={cl(classes.githubLink, className)} > Rediger denne siden på Github (åpnes i ny fane) diff --git a/apps/storefront/components/NavigationCard/NavigationCard.module.css b/apps/storefront/components/NavigationCard/NavigationCard.module.css index 29f3472683..b1ac814260 100644 --- a/apps/storefront/components/NavigationCard/NavigationCard.module.css +++ b/apps/storefront/components/NavigationCard/NavigationCard.module.css @@ -56,12 +56,22 @@ } .grey { - background-color: var(--ds-color-neutral-background-subtle); + background-color: var(--ds-color-neutral-background-default); box-shadow: none; + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-surface-default); + } } .white { background-color: var(--ds-color-neutral-background-default); + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-surface-default); + } } .title { diff --git a/apps/storefront/components/TeaserCard/TeaserCard.module.css b/apps/storefront/components/TeaserCard/TeaserCard.module.css index 07083cb08b..d75525ccbc 100644 --- a/apps/storefront/components/TeaserCard/TeaserCard.module.css +++ b/apps/storefront/components/TeaserCard/TeaserCard.module.css @@ -1,5 +1,5 @@ .card { - background-color: white; + background-color: var(--ds-color-neutral-background-default); padding: 32px; display: block; color: inherit; @@ -10,6 +10,11 @@ position: relative; z-index: 2; height: 100%; + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-surface-default); + } } .card:hover { @@ -31,7 +36,7 @@ .meta { margin-top: 14px; font-size: 15px; - color: #747474; + color: var(--ds-color-neutral-text-subtle); font-weight: 400; display: flex; gap: 12px; diff --git a/apps/storefront/components/Tokens/TokenList/TokenList.module.css b/apps/storefront/components/Tokens/TokenList/TokenList.module.css index 3ee51be5ab..47783b8a76 100644 --- a/apps/storefront/components/Tokens/TokenList/TokenList.module.css +++ b/apps/storefront/components/Tokens/TokenList/TokenList.module.css @@ -62,7 +62,6 @@ } .card { - background-color: #fff; border-radius: 4px; align-items: flex-start; align-items: center; @@ -81,7 +80,7 @@ .value { font-size: 15px; - color: #636363; + color: var(--ds-color-neutral-text-subtle); } .copy { diff --git a/apps/storefront/components/Tokens/TokenList/TokenList.tsx b/apps/storefront/components/Tokens/TokenList/TokenList.tsx index da664a2762..9ae8ebbc66 100644 --- a/apps/storefront/components/Tokens/TokenList/TokenList.tsx +++ b/apps/storefront/components/Tokens/TokenList/TokenList.tsx @@ -178,7 +178,7 @@ const TokenList = ({ type = 'color', hideValue = false, }: TokenListProps) => { - const [brand, setBrand] = useState('digdir'); + const [brand] = useState('digdir'); const [mode, setMode] = useState<'light' | 'dark'>('light'); const [cardColumns, setCardColumns] = useState(3); @@ -219,50 +219,23 @@ const TokenList = ({
{(showThemePicker || showModeSwitcher) && (
- {showThemePicker && ( + {showModeSwitcher && ( - Brand: {capitalizeString(brand)} + Mode: {capitalizeString(mode)} - setBrand('digdir')}> - Digdir - - - - setBrand('altinn')}> - Altinn + setMode('light')}> + Light - setBrand('tilsynet')}> - Tilsynet + setMode('dark')}> + Dark - - setBrand('portal')}> - Brreg - - - - - - )} - {showModeSwitcher && ( - - - Mode: {capitalizeString(mode)} - - - - setMode('light')}> - Light - - setMode('dark')}> - Dark - diff --git a/apps/storefront/layouts/MenuPageLayout/MenuPageLayout.tsx b/apps/storefront/layouts/MenuPageLayout/MenuPageLayout.tsx index 03dccb2f6b..347e009ab6 100644 --- a/apps/storefront/layouts/MenuPageLayout/MenuPageLayout.tsx +++ b/apps/storefront/layouts/MenuPageLayout/MenuPageLayout.tsx @@ -77,6 +77,16 @@ const MenuPageLayout = ({ content, data, banner }: PageLayoutProps) => {
+ ); }; diff --git a/apps/storefront/layouts/NavMenuPageLayout/NavMenuPageLayout.module.css b/apps/storefront/layouts/NavMenuPageLayout/NavMenuPageLayout.module.css index 9687784f44..55a0cdea51 100644 --- a/apps/storefront/layouts/NavMenuPageLayout/NavMenuPageLayout.module.css +++ b/apps/storefront/layouts/NavMenuPageLayout/NavMenuPageLayout.module.css @@ -19,4 +19,9 @@ .outerPage { background-color: var(--ds-color-neutral-background-subtle); + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-background-default); + } } diff --git a/apps/storefront/layouts/NavPageLayout/NavPageLayout.module.css b/apps/storefront/layouts/NavPageLayout/NavPageLayout.module.css index e120a282df..9a6056ad02 100644 --- a/apps/storefront/layouts/NavPageLayout/NavPageLayout.module.css +++ b/apps/storefront/layouts/NavPageLayout/NavPageLayout.module.css @@ -1,4 +1,9 @@ .content { - margin-bottom: var(--ds-spacing-12); - margin-top: var(--ds-spacing-12); + padding-bottom: var(--ds-spacing-12); + padding-top: var(--ds-spacing-12); + + [data-ds-color-mode='dark'] &, + [data-ds-color-mode='auto'] & { + background-color: var(--ds-color-neutral-background-default); + } } diff --git a/apps/storefront/public/animations/Page.webm b/apps/storefront/public/animations/Page.webm index 6a1f4f6fb0..017fcbb1a5 100644 Binary files a/apps/storefront/public/animations/Page.webm and b/apps/storefront/public/animations/Page.webm differ diff --git a/apps/storefront/public/animations/Theme.webm b/apps/storefront/public/animations/Theme.webm index 04420c3673..8d168c6a4f 100644 Binary files a/apps/storefront/public/animations/Theme.webm and b/apps/storefront/public/animations/Theme.webm differ diff --git a/apps/storefront/public/img/Logotest.svg b/apps/storefront/public/img/Logotest.svg index cc7bd355be..5fc51f9a92 100644 --- a/apps/storefront/public/img/Logotest.svg +++ b/apps/storefront/public/img/Logotest.svg @@ -1,5 +1,5 @@ - + diff --git a/apps/storefront/public/img/Toolbox.svg b/apps/storefront/public/img/Toolbox.svg index 59e46e9c9e..c6e078958c 100644 --- a/apps/storefront/public/img/Toolbox.svg +++ b/apps/storefront/public/img/Toolbox.svg @@ -1,6 +1,6 @@ - + diff --git a/apps/storefront/public/img/component-previews/Divider.svg b/apps/storefront/public/img/component-previews/Divider.svg index 6a25d3d2be..59b116f798 100644 --- a/apps/storefront/public/img/component-previews/Divider.svg +++ b/apps/storefront/public/img/component-previews/Divider.svg @@ -1,6 +1,7 @@ + - + diff --git a/apps/storefront/public/img/component-previews/Table.svg b/apps/storefront/public/img/component-previews/Table.svg index e4db653adf..32d2ab11a5 100644 --- a/apps/storefront/public/img/component-previews/Table.svg +++ b/apps/storefront/public/img/component-previews/Table.svg @@ -1,6 +1,6 @@ - + diff --git a/apps/storefront/public/img/component-previews/Typography.svg b/apps/storefront/public/img/component-previews/Typography.svg index c14aa8827f..515d93699e 100644 --- a/apps/storefront/public/img/component-previews/Typography.svg +++ b/apps/storefront/public/img/component-previews/Typography.svg @@ -1,6 +1,6 @@ - +