Skip to content

Commit

Permalink
Merge branch 'digdir:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
linus-jansson authored Oct 23, 2024
2 parents b5ee067 + 71efc07 commit e989fd3
Show file tree
Hide file tree
Showing 176 changed files with 9,844 additions and 8,861 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-insects-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

SkipLink: Add css variables
5 changes: 5 additions & 0 deletions .changeset/eight-dancers-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

ValidationMessage: fix icon abandoning the component when scrolling
5 changes: 5 additions & 0 deletions .changeset/empty-pears-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

Accordion: Add css variable for chevron
5 changes: 5 additions & 0 deletions .changeset/four-schools-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

Breadcrumbs: Add css variable for chevron
6 changes: 6 additions & 0 deletions .changeset/friendly-cups-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@digdir/designsystemet-css": patch
"@digdir/designsystemet-react": patch
---

Input: Sufficient color contrast for readonly
5 changes: 5 additions & 0 deletions .changeset/hip-brooms-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

Alert: fix icon abandoning the component when scrolling
5 changes: 5 additions & 0 deletions .changeset/hot-crews-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-react": patch
---

Popover: Make sure arrow does not leave the popover
5 changes: 5 additions & 0 deletions .changeset/kind-eyes-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-react": patch
---

Modal: Fix `onClose` not being called
6 changes: 6 additions & 0 deletions .changeset/olive-tools-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@digdir/designsystemet-css": patch

---

Tooltip: Add more variables
6 changes: 6 additions & 0 deletions .changeset/plenty-singers-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@digdir/designsystemet-css": patch
"@digdir/designsystemet-react": patch
---

Field: Adds `<Field>` component wrapping and connecting internal form elements for better accessibility
5 changes: 5 additions & 0 deletions .changeset/seven-tips-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-react": patch
---

Avatar: Fix `aria-hidden` being wrongly added to a fragment
5 changes: 5 additions & 0 deletions .changeset/strange-jars-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

Pagination: Add css variable for chevron
7 changes: 7 additions & 0 deletions .changeset/three-moles-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@digdir/designsystemet-theme": minor
"@digdir/designsystemet": minor
"@digdir/designsystemet-css": minor
---

Implemented a more flexible system of semantic border-radius tokens.
5 changes: 5 additions & 0 deletions .changeset/twelve-onions-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-css": patch
---

Modal backdrop was invisible in some browser versions. See https://caniuse.com/mdn-css_selectors_backdrop_inherit_from_originating_element for affected versions.
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

<div align="center">

---

</div>

## 📖 About Designsystemet
Expand All @@ -19,8 +17,6 @@ Designsystemet is a collection of important design elements, components and patt

Our goal is to create consistent and user-friendly experiences in digital solutions for public services, making them more efficient and reliable.

---

## 🔗 Links

[Storybook](https://storybook.designsystemet.no/) - Preview for React components.
Expand All @@ -29,8 +25,6 @@ Our goal is to create consistent and user-friendly experiences in digital soluti

[Theme](https://theme.designsystemet.no/) - Theme builder.

---

## 📦 Packages

[`@digdir/designsystemet`](https://www.npmjs.com/package/@digdir/designsystemet) - CLI for Designsystemet.
Expand All @@ -47,8 +41,6 @@ Our goal is to create consistent and user-friendly experiences in digital soluti

[`@digdir/design-system-tokens`](https://www.npmjs.com/package/@digdir/design-system-tokens) – Renamed to [`@digdir/designsystemet-theme`](https://www.npmjs.com/package/@digdir/designsystemet-theme)

---

## 🚀 Get started

Follow these steps to get started with the React components.
Expand Down Expand Up @@ -112,14 +104,10 @@ import { Button } from '@digdir/designsystemet-react';

`@digdir/designsystemet-theme` and `@digdir/designsystemet-css` only needs to be imported once.

---

## 🫶 Contributing

Learn how you can contribute to this project by reading our [Code of Conduct](./CODE_OF_CONDUCT.md) and [Contributing Guide](./CONTRIBUTING.md).

---

## 💪 Contributors

We are lucky to have a great group of people who help with the design system.
Expand All @@ -128,8 +116,9 @@ We are lucky to have a great group of people who help with the design system.
<img src="https://contrib.rocks/image?repo=digdir/designsystem" />
</a>

---
<br />
<br />

## 📃 License
<a href="https://www.chromatic.com/"><img src="https://user-images.githubusercontent.com/321738/84662277-e3db4f80-af1b-11ea-88f5-91d67a5e59f6.png" width="153" height="30" alt="Chromatic" /></a>

Designsystemet is [MIT licensed](./LICENSE).
Thanks to [Chromatic](https://www.chromatic.com/) for providing the visual testing platform that helps us review UI changes and catch visual regressions.
11 changes: 7 additions & 4 deletions apps/_components/src/ColorModal/ColorModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Modal, Paragraph } from '@digdir/designsystemet-react';
import { Heading, Modal, Paragraph } from '@digdir/designsystemet-react';
import type { ColorNumber } from '@digdir/designsystemet/color';
import {
getColorNameFromNumber,
Expand Down Expand Up @@ -58,9 +58,12 @@ export const ColorModal = ({
style={{
maxWidth: '1050px',
}}
backdropClose
>
<Modal.Block>
{`${capitalizeFirstLetter(namespace)} ${capitalizeFirstLetter(getColorNameFromNumber(weight))}`}
<Heading size='xs'>
{`${capitalizeFirstLetter(namespace)} ${capitalizeFirstLetter(getColorNameFromNumber(weight))}`}
</Heading>
</Modal.Block>
<Modal.Block className={classes.modalContent}>
<div className={classes.description}>
Expand Down Expand Up @@ -88,13 +91,13 @@ export const ColorModal = ({
value={getCssVariable(namespace, weight)}
copyBtn
/>
{!namespace.includes('Base') && (

{weight !== 9 && weight !== 10 && weight !== 11 && (
<Field
label='Brukes mot:'
value={getColorCombinations(weight)}
/>
)}
<Field label='' value='Mer informasjon om fargen kommer.' />
</div>
<div
className={classes.right}
Expand Down
18 changes: 11 additions & 7 deletions apps/_components/src/ColorModal/colorModalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,28 @@ export const getColorDescription = ({
description += ' er en bakgrunnsfarge som har et hint av farge i seg.';
} else if (weight === 3) {
description +=
' brukes på flater som ligger oppå bakgrunnsfargene i en nøytral state. Fargen brukes i Card komponenten.';
' brukes på flater som ligger oppå bakgrunnsfargene. Fargen brukes for eksempel i Card komponenten til Designsystemet.';
} else if (weight === 4) {
description +=
' brukes på interaktive elementer som ligger oppå bakgrunnsfargene i en hover state.';
' brukes på interaktive flater som ligger oppå bakgrunnsfargene i en hover state.';
} else if (weight === 5) {
description +=
' brukes på interaktive elementer som ligger oppå bakgrunnsfargene i en active state.';
' brukes på interaktive flater som ligger oppå bakgrunnsfargene i en active state.';
} else if (weight === 6) {
description +=
' er den lyseste border-fargen og brukes for å skille elementer fra hverandre. Fargen brukessom border-farge i Divider komponenten og i Tabeller.';
' er den lyseste border-fargen og brukes for å skille elementer fra hverandre.';
} else if (weight === 7) {
description +=
' er en border-farge som brukes når man ønsker god kontrast mot bakgrunnsfargene. Fargen brukes som border-farge i TextField komponenten.';
' er en border-farge som brukes når man ønsker god kontrast mot bakgrunnsfargene.';
} else if (weight === 8) {
description +=
' er den mørkeste border-fargen som brukes når man ønsker god kontrast.';
' er den mørkeste border-fargen og brukes når man ønsker en veldig tydelig og sterk border.';
} else if (weight === 9) {
description += ` er den lyseste tekstfargen og brukes på tekst som skal være litt mindre synlig eller for å skape variasjon i typografien.`;
description += ` fargen får den samme hex koden som fargen som er valgt i verktøyet. Brukes ofte som farge på viktige elementer og på flater som skal fange brukerens oppmerksomhet.`;
} else if (weight === 10) {
description += ` kan brukes som hover farge på elementer som bruker Base Default fargen. `;
} else if (weight === 11) {
description += ` kan brukes som active farge på elementer som bruker Base Default fargen`;
} else if (weight === 12) {
description +=
' er den lyseste tekstfargen og brukes på tekst som skal være litt mindre synlig eller for å skape variasjon i typografien.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}
}

.footer .logos img {
.footer .logos svg {
height: 26px;
width: auto;
margin-right: var(--ds-spacing-2);
Expand Down
98 changes: 98 additions & 0 deletions apps/_components/src/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { Button, Heading, Link, Paragraph } from '@digdir/designsystemet-react';
import cl from 'clsx/lite';
import Image from 'next/image';
import NextLink from 'next/link';
import { type ReactNode, forwardRef } from 'react';
import { Container } from '../';

import { Bronnoysund } from '../logos/Bronnoysund';
import { Digdir } from '../logos/Digdir';
import { Mattilsynet } from '../logos/Mattilsynet';
import { Udir } from '../logos/Udir';
import classes from './Footer.module.css';

type LinkListItemProps = {
text: string;
url: string;
prefix?: ReactNode;
};

const getCurrentYear = () => {
const date = new Date();
return date.getFullYear();
};

const LinkList = (links: LinkListItemProps[]) => {
return (
<ul className={classes.links}>
{links.map((item, index) => (
<li key={index}>
<Link href={item.url} color='neutral' className={classes.link}>
{item.prefix}
{item.text}
</Link>
</li>
))}
</ul>
);
};

type FooterProps = {
centerLinks: LinkListItemProps[];
rightLinks: LinkListItemProps[];
} & React.HTMLAttributes<HTMLElement>;

export const Footer = forwardRef<HTMLElement, FooterProps>(function Footer(
{ centerLinks, rightLinks, className, ...rest },
ref,
) {
return (
<footer
ref={ref}
className={cl(classes.footer, className)}
data-ds-color-mode='dark'
{...rest}
>
<div className={classes.top}>
<Container className={classes.container}>
<div>
<Heading size='xs' level={2} className={classes.title}>
Lages på tvers av offentlige etater:
</Heading>
<div className={classes.logos}>
<Digdir />
<Bronnoysund />
<Mattilsynet />
<Udir className={classes.udir} />
</div>
<Button asChild variant='secondary' color='neutral' size='sm'>
<NextLink
href='mailto:[email protected]'
className={classes.button}
>
Din etat? Ta kontakt!
</NextLink>
</Button>
</div>
<div>
<Heading size='xs' level={2} className={classes.title}>
Om nettstedet
</Heading>
{LinkList(centerLinks)}
</div>
<div>
<Heading size='xs' level={2} className={classes.title}>
Kom i kontakt med oss
</Heading>
{LinkList(rightLinks)}
</div>
</Container>
</div>
<div className={classes.bottom}>
<Container>
<Paragraph size='sm'>© {getCurrentYear()} Designsystemet</Paragraph>
</Container>
</div>
</footer>
);
});
File renamed without changes.
1 change: 1 addition & 0 deletions apps/_components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export { Header } from './Header/Header';
export { Figma } from './logos/Figma';
export { Github } from './logos/Github';
export { Slack } from './logos/Slack';
export { Footer } from './Footer/Footer';
37 changes: 37 additions & 0 deletions apps/_components/src/logos/Bronnoysund.tsx

Large diffs are not rendered by default.

Loading

0 comments on commit e989fd3

Please sign in to comment.