Compare commits

...
Author SHA1 Message Date
Ken d8b7e69788 📝 Datepicker i modal demo 2022-12-15 11:07:55 +01:00
Ken 097ef18910 ✨ Kan nå toggle lukking av modal med ESC 2022-12-15 10:57:03 +01:00
Ken bb081354fc ✨ Komponentvisning fra next -> prod 2022-12-15 10:10:29 +01:00
Ken edc08c6f8a 🐛 Fikset standalone-sider som fikk 404 2022-12-13 12:48:09 +01:00
Ken fc3577baf4 🐛 Fikset lenker på safari 2022-12-13 09:37:29 +01:00
Ken f02250ab75 🔧 Redirect fra /storybook til chromatic-instans 2022-12-11 21:00:00 +01:00
Ken 1af80dcc1b 🐛 ConfirmationPanel nå wrappet med divog ikke p 2022-12-06 15:00:45 +01:00
Ken 373f40d968 🐛 Fikset keyboard-event error i monthpicker 2022-12-06 14:07:09 +01:00
Ken 75609e1b09 🐛 Fikset duplikat className i dateinput 2022-12-04 18:39:32 +01:00
Ken ea9bb63d0a 🚚 temp url for migrering av ds sider 2022-12-03 17:46:48 +01:00
Ken a148b08eb5 🔥 Fjernet nissehatt 2022-12-03 17:29:02 +01:00
Ken 1ca7e746e1 💄 xmas etter 10 sec 2022-12-03 15:50:26 +01:00
Ken 535ed17d36 🐛 Fikset backup-script 2022-12-03 15:12:19 +01:00
Ken 8df1bc26a0 🐛 Fikser deploy-error grunnet duplikerte pakker 2022-12-02 21:11:54 +01:00
Kai Erik Schieren 1b15ab146a 🔥 remove cl 2022-12-02 15:33:17 +01:00
Kai Erik Schieren 0868b7d716 🚧 add buttons to dialogs 2022-12-02 15:31:01 +01:00
Ken 618d8d3de1 🔥 Fjernet ubrukt prop for TemaCard 2022-12-02 15:21:25 +01:00
Ken e9831b4e2a ⬆️ Oppdatert til next.sanity v3 2022-12-02 15:16:17 +01:00
Ken b0aa3ce0e7 🔥 Console.log 2022-12-02 15:14:15 +01:00
Ken 4fa62f5d64 🏷️ Sanity-typer 2022-12-02 15:05:32 +01:00
Ken 350e929bd2 🐛 Gjemme temp felt for aksel_tema 2022-12-02 14:24:07 +01:00
Ken 64d178ea36 Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-12-02 14:02:08 +01:00
Ken cb3decf3bd 👽 Migrert til nye preview 2022-12-02 13:58:45 +01:00
Ken d66d009fe8 👽 Migrert alle sider til nye preview-løsning 2022-12-02 13:30:45 +01:00
Ken 5974a77140 👽 Migrert god-praksis forside 2022-12-02 13:07:42 +01:00
Ken 68b4444bb1 ✨ Tema bruker nå en slug for url-håndtering 2022-12-02 13:02:18 +01:00
Kai Erik Schieren fc7d16b64b 🔥 cleanup 2022-12-02 11:43:07 +01:00
Kai Erik Schieren 08a893c29a 🚧 update dialogs 2022-12-02 11:25:04 +01:00
Kai Erik Schieren 8d181e7a92 🚧 publish dialog 2022-12-02 10:51:12 +01:00
Ken ab1c0849f4 👽 Migrert 3/7 sider til ny next-sanity verson (ds-forside) 2022-12-02 10:32:05 +01:00
Ken 96098e532f 👽 Migrert 2/7 sider til ny next-sanity verson 2022-12-02 10:15:07 +01:00
Ken 0b14ef50e9 🎨 editor-previews 2022-12-01 22:05:47 +01:00
Ken 262f8bf5d2 🎨 bedre editor-preview 2022-12-01 17:56:04 +01:00
Ken f18a2dde8f Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-12-01 17:29:32 +01:00
Ken 2e48c97b50 🎨 Custom tema-view2 2022-12-01 17:29:22 +01:00
Ken 8bf2b8f322 🎨 Oppdatert deskstruct for god-praksis 2022-12-01 15:33:57 +01:00
Kai Erik Schieren ceb7b231b5 ✨ add draft status badge 2022-12-01 15:19:19 +01:00
Kai Erik Schieren f7f304b33d ♻️ add includedSchemas as param 2022-12-01 14:37:53 +01:00
Kai Erik Schieren 151484afd3 🚧 ✨ update info action 2022-12-01 14:23:56 +01:00
Ken 7ae6969b35 Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-12-01 14:20:34 +01:00
Ken 65cfd8b459 📝 Oppdatert felt-tekster 2022-12-01 14:20:26 +01:00
Kai Erik Schieren 3c9405b718 🔥 remove publishaction 2022-12-01 13:33:16 +01:00
Kai Erik Schieren 48b347e814 🚧 focusAction wip 2022-12-01 13:14:32 +01:00
Ken 59de2d7992 🎨 Oppdatert field-struktur 2022-12-01 13:10:57 +01:00
Ken 0166c17985 🎨 Oppdatert inputfelt med counter 2022-12-01 12:49:27 +01:00
Ken 57b1de13a9 🎨 Sanity-ikoner 2022-12-01 10:17:04 +01:00
Ken 52104b0f23 🐛 Fikset url-feil 2022-11-30 21:39:31 +01:00
Ken 564a6b4b90 ✨ Preview for artikler 2022-11-30 21:32:50 +01:00
Ken d43a4bfbdb ✨ God-praksis visning 2022-11-30 20:52:19 +01:00
Ken 1e647bffc6 ✨ Generisk Pane med teller 2022-11-30 19:49:52 +01:00
Ken 986c43ead3 Merge branch 'master' into next 2022-11-30 17:07:00 +01:00
Ken ea4fffdeba 🔥 Fjernet referanser til slug_v2 2022-11-30 17:06:35 +01:00
Ken c14e9c346b Merge branch 'next' 2022-11-30 16:07:43 +01:00
Kai Erik Schieren d3dd96d2d4 🚧 godkjenn innhold wip 2022-11-30 15:54:52 +01:00
Ken b5fd3dd734 📝 console endring 2022-11-30 15:44:38 +01:00
Ken 6979811e67 ⚰️ Fjernet isMigrated felt 2022-11-30 15:18:14 +01:00
Andreas Nordahl 82ab82889d update cdn-upload action (#1725) 2022-11-30 15:16:32 +01:00
Ken 0b978693d6 ⚰️ Fjernet tmp slug_v2 2022-11-30 14:36:07 +01:00
Ken feabc168d7 🐛 Fikset build-error 2022-11-30 14:31:22 +01:00
Ken 759c12eeef Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-11-30 14:26:25 +01:00
Ken e3bc4f99a0 🎨 Slug-migrerings script 2022-11-30 14:26:07 +01:00
Kai Erik Schieren 8c31007854 🐛 only use custom badges for included schemas 2022-11-30 14:23:12 +01:00
Kai Erik Schieren cf80626256 🚧 publication flow approve content set verified 2022-11-30 14:17:21 +01:00
Ken cbcfecbe72 🎨 Slug-migrerings script 2022-11-30 14:10:22 +01:00
Ken a1ae58d041 🚚 Oppdatert struktur for god-praksis migrering 2022-11-30 14:08:27 +01:00
Ken a6cf7c1f25 Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-11-30 12:46:11 +01:00
Ken a31a969863 🚚 oppdatert slug for alle god-praksis artikler 2022-11-30 12:44:58 +01:00
Ken 19504b0d32 🚧 god-praksis migrerings-script 2022-11-30 12:43:38 +01:00
Kai Erik Schieren 920a037b47 🚧 publication flow approve content wip 2022-11-30 12:16:23 +01:00
Ken 568f55e4be 🏷️ Sanity-typer 2022-11-30 10:38:39 +01:00
Kai Erik Schieren 53cbedf041 ✨ add discardChanges to publication-flow 2022-11-30 10:33:57 +01:00
Kai Erik Schieren cb356c23dc ✨ add restore to publication flow 2022-11-30 10:28:20 +01:00
Kai Erik Schieren 8f76acc776 🔥 delete console logs 2022-11-30 10:21:34 +01:00
Ken d0269a84c0 Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-11-30 10:19:45 +01:00
Ken e36206197d 🧱 v2 slug-felt for migrering av god-praksis 2022-11-30 10:19:35 +01:00
Kai Erik Schieren 5e6bb7e016 ✨ ✏️ add duplicate to publication-flow
and fix some typos
2022-11-30 10:18:34 +01:00
Ken 15ed6b0f2f 🎉 Ny god-praksis pages struktur 2022-11-30 10:09:57 +01:00
Kai Erik Schieren 16142657ec ✨ add delete to publication-flow 2022-11-30 10:09:23 +01:00
Kai Erik Schieren a5b50f4cef ✨ add unpublish to publication-flow 2022-11-30 09:57:05 +01:00
Kai Erik Schieren 796b7ac49f 🧱 create plugin structure 2022-11-30 09:45:20 +01:00
Kai Erik Schieren 9bafc3e218 💬 update custom badges 2022-11-30 09:14:36 +01:00
Ken 72c04454e5 🐛 Fikset sitemap 2022-11-29 23:15:28 +01:00
Ken dc4ad88427 🎨 Fjernet task-analytics fra admin-visning 2022-11-29 21:31:02 +01:00
Ken 00ecf7c67c 🐛 Fikset forsidelenke for blogger 2022-11-29 21:18:02 +01:00
Ken 83f8127570 🐛 Fikset e2e for migrering 2022-11-29 21:00:52 +01:00
Ken b6017ea5cf Merge branch 'next' 2022-11-29 20:46:32 +01:00
Ken b96036d14a 🚚 Oppdatert blogg-url er 2022-11-29 20:44:50 +01:00
Kai Erik Schieren d0fafb41b3 ♻️ custom badge 2022-11-29 18:51:28 +01:00
Ken ddf8f65499 🎨 Begynt på god-praksis struktur 2022-11-29 17:06:39 +01:00
Ken 31aa6243ef ✨ Bedre kategorisering og avatar 2022-11-29 16:34:19 +01:00
Ken afca0f481a ✨ Prinsippsider 2022-11-29 15:58:01 +01:00
Ken 2ffc2c22dc ✨ Bloggsider 2022-11-29 15:47:37 +01:00
Ken d8100c1589 🐛 Statusbadge 2022-11-29 15:35:40 +01:00
Ken a4cce95171 Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-11-29 15:34:06 +01:00
Ken 01ab8e5741 ✨ profilside 2022-11-29 15:33:39 +01:00
Kai Erik Schieren dd1a961dd2 ✨ custom article status badge 2022-11-29 15:21:02 +01:00
Ken 11520ce468 ✨ Oppdatert deskstruct 2022-11-29 15:14:38 +01:00
Ken 20c8f9204b ✨ Ny navigasjon for komponentsider i sanity 2022-11-29 14:15:38 +01:00
Ken 0074bfd5fb 🐛 Fikset sanity-backup 2022-11-29 12:41:01 +01:00
Kai Erik Schieren a0504f4e57 use lastVerified 2022-11-29 12:12:03 +01:00
Kai Erik Schieren 7bcac33423 🚧 custom publish 2022-11-29 12:07:39 +01:00
Ken a6feaea201 🐛 Fikset sanity-backup 2022-11-29 11:56:06 +01:00
Ken 9c6cf8c811 📝 Popover docs 2022-11-29 11:34:57 +01:00
Kai Erik Schieren 592e0ccae9 🚧 set up custom publish 2022-11-29 11:04:41 +01:00
Ken f2f44ad2d7 🔥 Fjernet påbegynt kategori-løsning 2022-11-29 10:50:23 +01:00
Ken 322077fff8 Merge branch 'next' of https://github.com/navikt/Designsystemet into next 2022-11-29 09:19:30 +01:00
Ken 5eaf729cc4 🎉 Påbegynt ny navigasjon ds 2022-11-29 09:19:17 +01:00
Kai Erik Schieren f285477a6c 🚧 updateInfo refactor ++ 2022-11-29 08:18:12 +01:00
Ken 16f693cee9 🚚 Migert alle sanity-dokumenter 2022-11-28 20:04:58 +01:00
Ken 2a7198e02b 🚚 Migrert blogg-mal 2022-11-28 19:11:10 +01:00
Ken 98b4f4e76a 🐛 Fikset schema-error 2022-11-28 18:07:18 +01:00
Kai Erik Schieren cf397f2522 🔥 cleanup 2022-11-28 16:44:19 +01:00
Kai Erik Schieren 7f1305c639 🚧 updateInfo wip 2022-11-28 16:41:19 +01:00
Ken 5964775a8e 🐛 Fikset typer 2022-11-28 16:31:47 +01:00
Ken f1ea4ee1e0 🚚 Migrert over ds_artikkel 2022-11-28 15:36:09 +01:00
Ken cc24357a9e 🔥 linting 2022-11-28 15:21:43 +01:00
Ken 53406e54a9 🐛 Viser nå task-analytics på alle sider 2022-11-28 15:17:26 +01:00
Ken 39faa2b945 🚚 Migrert aksel_artikkel 2022-11-28 15:09:43 +01:00
Ken 02e5978664 🔥 Cleanup ds_artikkel 2022-11-28 14:52:10 +01:00
Ken fa20f601df 🎨 Flyttet task-analytics til sidemaler 2022-11-28 14:38:38 +01:00
Ken 132ee94235 🎨 Task-analytics 2022-11-28 13:20:15 +01:00
Ken fa5aa175ab 🔥 Fjernet kode for bruk_tab 2022-11-28 11:52:49 +01:00
Ken cf8833c885 🎨 Bedre slug 2022-11-27 20:27:28 +01:00
Ken a37f42b28a 🚚 Migrert slug-håndtering 2022-11-27 18:29:58 +01:00
Ken b8e797bc92 🚚 Migrert moduler for dokumenter 2022-11-27 18:02:04 +01:00
Ken c248cb2a57 ⚡ Minsket first load med 120kB, eksempler med 50% 2022-11-27 13:48:02 +01:00
Ken 2a748c7903 🏷️ Sanity-typer 2022-11-27 13:25:56 +01:00
Ken 2f2cbc16ca 🔥 Fjernet gammel artikkelmal 2022-11-27 13:22:27 +01:00
Ken c0b8928ece 🏷️ rename innholdsfelt komponentsider 2022-11-27 12:43:38 +01:00
Ken 50fe0e785b 🚚 Migrert komponent-artikkel 2022-11-27 12:31:58 +01:00
Ken b2d31aed46 🚚 Migrert ds-schemas 2022-11-26 22:48:27 +01:00
9fdf2cd4df Sync next-branch med master (#1724)
Co-authored-by: Ken <KenAJoh@users.noreply.github.com>
Co-authored-by: Kai Erik Schieren <kai.schieren@soprasteria.com>
2022-11-26 21:02:29 +01:00
Ken 02aa151153 ♿ Fikser siteimprove-error 2022-11-25 14:39:58 +01:00
Ken a472fc4793 🔥 Fjernet utkommentert kode 2022-11-25 14:27:13 +01:00
Ken fdab54742f ⚡ Lazy-loading av bilder i komponent-oversikt 2022-11-25 14:26:42 +01:00
Ken 53230c1d67 🐛 Fikset border-width bug i button 2022-11-25 13:19:22 +01:00
Ken d6dfdff964 📝 Oppdatert beta tekster 2022-11-25 10:28:28 +01:00
Ken 2feb10005c 💄 Skeleton-visning for ikonside 2022-11-25 10:19:26 +01:00
199 changed files with 24129 additions and 7347 deletions

No files matched your search

+3 -3
View File
@@ -24,10 +24,10 @@ jobs:
${{ runner.os }}-build-
- name: Install dependencies
run: yarn
run: cd aksel.nav.no/sanity && yarn
- name: Export dataset
run: SANITY_TOKEN=${{secrets.SANITY_DATASET_EDITOR_TOKEN}} yarn workspace aksel.nav.no sanity:backup
run: cd aksel.nav.no/sanity && SANITY_TOKEN=${{secrets.SANITY_DATASET_EDITOR_TOKEN}} yarn backup
- name: Upload GCP bucket
uses: "google-github-actions/auth@v0"
with:
@@ -36,4 +36,4 @@ jobs:
with:
path: ./aksel.nav.no/sanity
destination: "aksel-website-prod/backups"
glob: "**/backup-*.tar.gz"
glob: "backup-*.tar.gz"
+1 -2
View File
@@ -20,9 +20,8 @@ jobs:
- uses: "actions/checkout@v3"
- id: upload
uses: nais/frontend-plattform-cdn-upload-action@main
uses: navikt/frontend/actions/cdn-upload/v1@main
with:
cdn-environment: cdn.nav.no
cdn-team-name: aksel
source: ./fonts
destination: "" # uploads folder to team root
+1
View File
@@ -148,3 +148,4 @@ tmp.json
/playwright/.cache/
playwright-report/
/test-results/
backup-*.tar.gz
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-codemod
## 2.0.9
## 2.0.8
## 2.0.7
## 2.0.6
## 2.0.5
## 2.0.4
## 2.0.3
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-codemod",
"version": "2.0.4",
"version": "2.0.9",
"description": "Aksel codemods for NAVs designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
+2 -3
View File
@@ -39,8 +39,8 @@
"build-pict": "svgr --silent --index-template index-template.js --out-dir src/pictograms pictograms"
},
"dependencies": {
"@navikt/ds-icons": "^2.0.4",
"@navikt/ds-react": "^2.0.4",
"@navikt/ds-icons": "^2.0.9",
"@navikt/ds-react": "^2.0.9",
"clsx": "^1.1.1"
},
"devDependencies": {
@@ -51,7 +51,6 @@
"@rollup/plugin-commonjs": "23.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@svgr/cli": "6.2.1",
"@types/node": "^17.0.35",
"concurrently": "7.2.1",
"copyfiles": "2.4.1",
"postcss-combine-duplicated-selectors": "10.0.3",
+14
View File
@@ -1,5 +1,19 @@
# @navikt/ds-css
## 2.0.9
## 2.0.8
## 2.0.7
## 2.0.6
## 2.0.5
### Patch Changes
- Reverserte border-width endrind i button
## 2.0.4
## 2.0.3
+4 -4
View File
@@ -119,7 +119,7 @@
.navds-button--secondary {
color: var(--ac-button-secondary-text, var(--a-text-action));
background-color: var(--ac-button-secondary-bg, var(--a-surface-default));
box-shadow: inset 0 0 0 1.5px var(--ac-button-secondary-border, var(--a-border-action));
box-shadow: inset 0 0 0 2px var(--ac-button-secondary-border, var(--a-border-action));
}
.navds-button--secondary:hover {
@@ -128,7 +128,7 @@
}
.navds-button--secondary:focus {
box-shadow: inset 0 0 0 1.5px var(--ac-button-secondary-focus-border, var(--a-border-action)), var(--a-shadow-focus);
box-shadow: inset 0 0 0 2px var(--ac-button-secondary-focus-border, var(--a-border-action)), var(--a-shadow-focus);
}
.navds-button--secondary:active {
@@ -145,7 +145,7 @@
.navds-button--secondary:hover:where(:disabled, .navds-button--disabled) {
color: var(--ac-button-secondary-text, var(--a-text-action));
background-color: var(--ac-button-secondary-bg, var(--a-surface-default));
box-shadow: inset 0 0 0 1.5px var(--ac-button-secondary-border, var(--a-border-action));
box-shadow: inset 0 0 0 2px var(--ac-button-secondary-border, var(--a-border-action));
}
/****************************
@@ -162,7 +162,7 @@
}
.navds-button--tertiary:focus {
box-shadow: inset 0 0 0 1.5px var(--ac-button-tertiary-focus-border, var(--a-border-action)), var(--a-shadow-focus);
box-shadow: inset 0 0 0 2px var(--ac-button-tertiary-focus-border, var(--a-border-action)), var(--a-shadow-focus);
}
.navds-button--tertiary:active {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "2.0.4",
"version": "2.0.9",
"description": "CSS for NAV Designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -20,7 +20,7 @@
"watch": "postcss --watch --use postcss-import -o dist/index.css index.css"
},
"devDependencies": {
"@navikt/ds-tokens": "^2.0.4",
"@navikt/ds-tokens": "^2.0.9",
"normalize.css": "^8.0.1",
"postcss": "^8.4.0",
"postcss-cli": "^9.0.0",
+43
View File
@@ -1,5 +1,48 @@
# @navikt/ds-react
## 2.0.9
### Patch Changes
- ShouldCloseOnEsc i Modal
- Updated dependencies []:
- @navikt/ds-icons@2.0.9
## 2.0.8
### Patch Changes
- Confirmationpanel wrappet med div
- Updated dependencies []:
- @navikt/ds-icons@2.0.8
## 2.0.7
### Patch Changes
- :bug: Fikset keyboard-click i monthpicker
- Updated dependencies []:
- @navikt/ds-icons@2.0.7
## 2.0.6
### Patch Changes
- DateInput hadde duplikat className satt
- Updated dependencies []:
- @navikt/ds-icons@2.0.6
## 2.0.5
### Patch Changes
- Updated dependencies []:
- @navikt/ds-icons@2.0.5
## 2.0.4
### Patch Changes
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "2.0.4",
"version": "2.0.9",
"description": "Aksel react-components for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -37,7 +37,7 @@
},
"dependencies": {
"@floating-ui/react-dom-interactions": "0.9.2",
"@navikt/ds-icons": "^2.0.4",
"@navikt/ds-icons": "^2.0.9",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
@@ -52,7 +52,6 @@
"@testing-library/user-event": "^14.2.0",
"@types/faker": "5.5.8",
"@types/jest": "^29.0.0",
"@types/node": "^17.0.35",
"@types/react-modal": "^3.13.1",
"concurrently": "7.2.1",
"copyfiles": "^2.4.1",
@@ -108,7 +108,6 @@ const DateInput: DateInputType = forwardRef<HTMLInputElement, DateInputProps>(
autoComplete="off"
aria-controls={ariaId}
className={cl(
className,
"navds-date__field-input",
"navds-text-field__input",
"navds-body-short",
@@ -74,7 +74,6 @@ export const MonthButton = ({
: -1
}
onKeyDown={(e) => {
e.preventDefault();
const next = nextEnabled(
months,
e.key,
@@ -51,6 +51,7 @@ export const ConfirmationPanel = forwardRef<
size={props.size}
className="navds-confirmation-panel__content"
id={`confirmation-panel-${id}`}
as="div"
>
{children}
</BodyLong>
+6
View File
@@ -36,6 +36,10 @@ export interface ModalProps {
* @default true
*/
closeButton?: boolean;
/**
*
*/
shouldCloseOnEsc?: boolean;
/**
* Allows custom styling of ReactModal, in accordance with their typing
*/
@@ -75,6 +79,7 @@ export const Modal = forwardRef<ReactModal, ModalProps>(
className,
overlayClassName,
shouldCloseOnOverlayClick = true,
shouldCloseOnEsc = true,
closeButton = true,
"aria-describedby": ariaDescribedBy,
"aria-labelledby": ariaLabelledBy,
@@ -123,6 +128,7 @@ export const Modal = forwardRef<ReactModal, ModalProps>(
className={cl("navds-modal", className)}
overlayClassName={cl("navds-modal__overlay", overlayClassName)}
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
shouldCloseOnEsc={shouldCloseOnEsc}
onRequestClose={(e) => onModalCloseRequest(e)}
aria={{
describedby: ariaDescribedBy,
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-tailwind
## 2.0.9
## 2.0.8
## 2.0.7
## 2.0.6
## 2.0.5
## 2.0.4
## 2.0.3
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tailwind",
"version": "2.0.4",
"version": "2.0.9",
"description": "Tailwind config based on @navikt/ds-tokens",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -22,9 +22,8 @@
"directory": "@navikt/core/tailwind"
},
"devDependencies": {
"@navikt/ds-tokens": "^2.0.4",
"@navikt/ds-tokens": "^2.0.9",
"@types/jest": "^29.0.0",
"@types/node": "^17.0.35",
"color": "4.2.3",
"jest": "^29.0.0",
"lodash": "^4.17.21",
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-tokens
## 2.0.9
## 2.0.8
## 2.0.7
## 2.0.6
## 2.0.5
## 2.0.4
## 2.0.3
+1 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "2.0.4",
"version": "2.0.9",
"description": "Design-tokens for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -31,7 +31,6 @@
},
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/node": "^17.0.35",
"color": "4.2.3",
"jest": "^29.0.0",
"lodash": "^4.17.21",
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-icons
## 2.0.9
## 2.0.8
## 2.0.7
## 2.0.6
## 2.0.5
## 2.0.4
### Patch Changes
+1 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-icons",
"version": "2.0.4",
"version": "2.0.9",
"description": "Aksel icons for NAV",
"author": "Aksel | NAV designsystem team",
"repository": {
@@ -49,7 +49,6 @@
"@svgr/cli": "6.2.1",
"@types/jest": "^29.0.0",
"@types/lodash.startcase": "^4.4.6",
"@types/node": "^17.0.35",
"@types/rimraf": "3.0.2",
"axios": "^0.21.3",
"concurrently": "7.2.1",
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-css-internal
## 2.0.9
## 2.0.8
## 2.0.7
## 2.0.6
## 2.0.5
## 2.0.4
## 2.0.3
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css-internal",
"version": "2.0.4",
"version": "2.0.9",
"description": "CSS for NAV internal Designsystem-components",
"author": "Aksel | NAV designsystem team",
"keywords": [
+40
View File
@@ -1,5 +1,45 @@
# @navikt/ds-react-internal
## 2.0.9
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@2.0.9
- @navikt/ds-icons@2.0.9
## 2.0.8
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@2.0.8
- @navikt/ds-icons@2.0.8
## 2.0.7
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@2.0.7
- @navikt/ds-icons@2.0.7
## 2.0.6
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@2.0.6
- @navikt/ds-icons@2.0.6
## 2.0.5
### Patch Changes
- Updated dependencies []:
- @navikt/ds-react@2.0.5
- @navikt/ds-icons@2.0.5
## 2.0.4
### Patch Changes
+3 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react-internal",
"version": "2.0.4",
"version": "2.0.9",
"description": "Aksel react components for internal UIs in NAV",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -35,13 +35,12 @@
"watch": "tsc --watch -p tsconfig.esm.json"
},
"dependencies": {
"@navikt/ds-icons": "^2.0.4",
"@navikt/ds-react": "^2.0.4",
"@navikt/ds-icons": "^2.0.9",
"@navikt/ds-react": "^2.0.9",
"clsx": "^1.1.1",
"copy-to-clipboard": "^3.3.1"
},
"devDependencies": {
"@types/node": "^17.0.35",
"concurrently": "7.2.1",
"rimraf": "^3.0.2",
"ts-node": "10.9.0",
+9 -3
View File
@@ -7,12 +7,17 @@
"tags": ["designsystem", "docs"]
},
{
"url": "https://aksel.nav.no/artikkel/",
"url": "https://aksel.nav.no/god-praksis/",
"tags": ["aksel"],
"selectors_key": "aksel"
},
{
"url": "https://aksel.nav.no/blogg/",
"url": "https://aksel.nav.no/produktbloggen/",
"tags": ["aksel"],
"selectors_key": "aksel"
},
{
"url": "https://aksel.nav.no/prinsipper/",
"tags": ["aksel"],
"selectors_key": "aksel"
}
@@ -41,7 +46,8 @@
"selectors_exclude": [".algolia-ignore-index"],
"stop_urls": [
"https://aksel.nav.no/preview",
"https://old-design-nav.vercel.app"
"https://old-design-nav.vercel.app",
"https://aksel.nav.no/eksempler"
],
"sitemap_urls": ["https://aksel.nav.no/api/sitemap"],
"js_render": true
+8 -12
View File
@@ -8,25 +8,21 @@
"dev": "yarn workspace website dev",
"build:next": "yarn workspace website build",
"serve:next": "yarn workspace website start",
"sanity": "yarn workspace sanity start",
"sanity:deploy": "yarn workspace sanity deploy",
"sanity:backup": "yarn workspace sanity backup",
"sanity:update": "yarn workspace website update:sanity",
"test": "yarn workspace website test"
},
"workspaces": [
"sanity",
"website"
],
"dependencies": {
"@navikt/ds-codemod": "^2.0.4",
"@navikt/ds-css": "^2.0.4",
"@navikt/ds-css-internal": "^2.0.4",
"@navikt/ds-icons": "^2.0.4",
"@navikt/ds-react": "^2.0.4",
"@navikt/ds-react-internal": "^2.0.4",
"@navikt/ds-tailwind": "^2.0.4",
"@navikt/ds-tokens": "^2.0.4"
"@navikt/ds-codemod": "^2.0.9",
"@navikt/ds-css": "^2.0.9",
"@navikt/ds-css-internal": "^2.0.9",
"@navikt/ds-icons": "^2.0.9",
"@navikt/ds-react": "^2.0.9",
"@navikt/ds-react-internal": "^2.0.9",
"@navikt/ds-tailwind": "^2.0.9",
"@navikt/ds-tokens": "^2.0.9"
},
"devDependencies": {
"prettier-plugin-tailwindcss": "^0.1.13"
+1
View File
@@ -0,0 +1 @@
.yarn/cache
Binary file not shown.
@@ -68,7 +68,9 @@ export const akselInnhold = async () => {
})
)
),
S.listItem().title("Blogg").child(S.documentTypeList("aksel_blogg")),
S.listItem()
.title("Produktbloggen")
.child(S.documentTypeList("aksel_blogg")),
S.listItem()
.title("Prinsipper")
.child(
@@ -93,18 +93,10 @@ export const dsPanel = async (roles) => {
.title("Eksempler")
.icon(() => <span>{`EX`}</span>)
.child(S.documentTypeList("kode_eksempler_fil")),
S.listItem()
.title("Fargekategorier")
.icon(() => <Folder />)
.child(S.documentTypeList("ds_color_categories")),
S.listItem()
.title("Props")
.icon(() => <Folder />)
.child(S.documentTypeList("ds_props")),
S.listItem()
.title("Tokens")
.icon(() => <Folder />)
.child(S.documentTypeList("ds_tokens")),
S.listItem()
.title("Token-kategorier")
.icon(() => <Folder />)
+2 -1
View File
@@ -5,5 +5,6 @@
"@sanity/form-builder": "b38478227ba5e22c91981da4b53436df22e48ff25238a55a973ed620be5068aa",
"@sanity/data-aspects": "d199e2c199b3e26cd28b68dc84d7fc01c9186bf5089580f2e2446994d36b3cb6",
"@sanity/vision": "da5b6ed712703ecd04bf4df560570c668aa95252c6bc1c41d6df1bda9b8b8f60",
"power-table": "922902575995e62af8f628e6abe652ecc5f3b1e1d2dec5859392e79e47707088"
"power-table": "922902575995e62af8f628e6abe652ecc5f3b1e1d2dec5859392e79e47707088",
"table": "e56785cc6cecbacf8ebe6bb99ffae32b973e233503c0714497ac7df3042863f1"
}
-24
View File
@@ -38,14 +38,6 @@ export const publishedAtField = {
!currentUser.roles.find((x) => x.name === "administrator"),
};
export const migratedField = {
title: "Migrert riktekst",
name: "isMigrated",
type: "boolean",
hidden: true,
initialValue: true,
};
export const titleField = {
title: "Sidetittel",
name: "heading",
@@ -111,19 +103,3 @@ export const innholdFieldNewNested = (name?: string, type?: string) => {
delete fields.group;
return fields;
};
export const hidePageFeedback = {
title: "Tilbakemeldinger",
name: "metadata_feedback",
type: "object",
group: "settings",
fields: [
{
title: "Skjul artikkel feedback modul",
description: "Gjemmer <<Var denne artikkelen til hjelp?>> modulen.",
name: "hide_feedback",
type: "boolean",
initialValue: false,
},
],
};
+5 -1
View File
@@ -10,7 +10,10 @@
"build": "sanity build",
"deploy": "yarn typegen && sanity deploy",
"backup": "node scripts/backup.js",
"typegen": "sanity exec typegen.ts"
"typegen": "sanity exec typegen.ts",
"sanity:dev": "sanity start",
"sanity:deploy": "yarn typegen && sanity deploy",
"sanity:backup": "node scripts/backup.js"
},
"main": "package.json",
"keywords": [
@@ -29,6 +32,7 @@
"@sanity/export": "^2.30.3",
"@sanity/production-preview": "^2.29.3",
"@sanity/react-hooks": "^2.35.0",
"@sanity/ui": "^0.37.22",
"@sanity/vision": "^2.35.0",
"moment": "2.29.4",
"sanity-codegen": "0.9.8",
@@ -4,7 +4,6 @@ import {
groups,
ingressField,
innholdFieldNew,
migratedField,
publishedAtField,
relevanteArtiklerField,
sanitySlug,
@@ -12,7 +11,7 @@ import {
titleField,
} from "@/lib";
const prefix = "artikkel/";
const prefix = "god-praksis/artikler/";
export default {
title: "Aksel Artikkel",
@@ -24,7 +23,7 @@ export default {
publishedAtField,
editorField,
titleField,
sanitySlug(prefix, 2),
sanitySlug(prefix, 3),
{
title: "Tema",
description: "Legg til de viktigeste temaene",
@@ -39,6 +38,5 @@ export default {
relevanteArtiklerField,
SEOFields,
migratedField,
],
};
@@ -1,5 +0,0 @@
export { default as Artikkel } from "./articles/artikkel";
export { default as Blogg } from "./articles/blogg";
export { default as Tema } from "./tema";
export { default as Prinsipp } from "./articles/prinsipp";
export { default as Standalone } from "./articles/standalone";
@@ -4,14 +4,13 @@ import {
groups,
ingressField,
innholdFieldNew,
migratedField,
publishedAtField,
sanitySlug,
SEOFields,
titleField,
} from "@/lib";
const prefix = "blogg/";
const prefix = "produktbloggen/";
export default {
title: "Blogg",
@@ -28,6 +27,5 @@ export default {
innholdFieldNew,
SEOFields,
migratedField,
],
};
@@ -1,4 +1,4 @@
import { KomponentArtikkel } from "./index";
import KomponentArtikkel from "./komponent";
export default {
...KomponentArtikkel,
@@ -1,83 +0,0 @@
import {
defaultDocPreview,
editorField,
groups,
hidePageFeedback,
innholdFieldNew,
innholdFieldNewNested,
migratedField,
publishedAtField,
sanitySlug,
titleField,
} from "@/lib";
const prefix = "designsystem/side/";
export default {
title: "Artikkel",
name: "ds_artikkel",
type: "document",
groups,
...defaultDocPreview,
fields: [
migratedField,
publishedAtField,
editorField,
titleField,
sanitySlug(prefix, 3),
{
title: "Layout",
description:
"'Full' bruker hele bredden, men fjerner table of content (bruk bare for eks ikonside eller komponentvisning)",
name: "layout",
type: "string",
group: "settings",
options: {
list: [
{ title: "Full", value: "full" },
{ title: "Default", value: "default" },
],
layout: "radio",
},
initialValue: "default",
},
{
type: "boolean",
name: "artikkel_type",
title: "Bruk Tabs",
group: "innhold",
initialValue: false,
},
{
...innholdFieldNew,
type: "riktekst_ds_artikkel",
hidden: ({ document }) => !!document?.artikkel_type,
},
{
name: "content_tabs",
title: "Innhold i Tabs",
type: "array",
group: "innhold",
hidden: ({ document }) => !document?.artikkel_type,
of: [
{
name: "tab",
title: "Tab",
type: "object",
fields: [
{
title: "Tittel",
description: "Innhold vil da legges under url/tab-tittel",
name: "title",
type: "string",
validation: (Rule) =>
Rule.required().error("Tabben må ha en enkel tittel"),
},
innholdFieldNewNested(),
],
},
],
},
hidePageFeedback,
],
};
@@ -1,93 +0,0 @@
export default {
title: "Fargekategori",
name: "ds_color_categories",
type: "document",
fields: [
{
title: "Tittel",
name: "title",
type: "string",
validation: (Rule) => Rule.required(),
},
{
title: "Beskrivelse",
name: "description",
type: "riktekst_enkel",
},
{
type: "array",
name: "colors",
title: "Farger",
of: [{ type: "ds_color" }],
options: {
sortable: false,
},
},
],
};
export const Color = {
name: "ds_color",
title: "Farge",
type: "object",
fields: [
{
name: "title",
title: "Navn",
type: "string",
validation: (Rule) => Rule.required(),
readOnly: true,
},
{
name: "full_title",
title: "CSS variabelnavn",
type: "string",
validation: (Rule) => Rule.required(),
readOnly: true,
},
{
title: "Fargetype/nivå",
name: "color_type",
type: "string",
validation: (Rule) => Rule.required(),
initialValue: "global",
readOnly: true,
options: {
layout: "radio",
list: [
{ value: "global", title: "Global" },
{ value: "semantic", title: "Semantic" },
],
},
},
{
name: "color_name",
title: "Brukt fargenavn",
type: "string",
readOnly: true,
hidden: ({ parent }) => parent?.color_type === "global",
},
{
name: "color_roles",
title: "Fargeroller",
type: "array",
hidden: ({ parent }) => parent?.color_type === "global",
of: [{ type: "string", name: "role" }],
},
{
name: "color_value",
title: "Brukt farge",
type: "string",
readOnly: true,
validation: (Rule) => Rule.required(),
},
{
name: "color_index",
title: "Fargeindeks",
type: "number",
description:
"Brukes for å endre rekkefølgen på listen. Farger med indeks 0 vil være først, større tall sorteres under der igjen",
},
],
__experimental_omnisearch_visibility: false,
};
@@ -1,45 +0,0 @@
export default {
title: "Tokens",
name: "ds_tokens",
type: "document",
fields: [
{
title: "Navn",
name: "title",
type: "string",
validation: (Rule) => Rule.required(),
readOnly: true,
},
{
title: "Verdi",
name: "token",
type: "string",
validation: (Rule) => Rule.required(),
readOnly: true,
},
{
title: "Faktisk verdi",
name: "raw",
type: "string",
readOnly: true,
},
{
title: "Parent",
name: "parent",
type: "string",
readOnly: true,
},
{
title: "Beskrivelse",
name: "beskrivelse",
type: "string",
},
{
title: "Autogenerert",
name: "autogenerated",
type: "boolean",
readOnly: true,
},
],
__experimental_omnisearch_visibility: false,
};
@@ -1,14 +0,0 @@
export { default as KomponentArtikkel } from "./articles/komponent";
export { default as Artikkel } from "./articles/artikkel";
export { default as ComponentTemplate } from "./component-template";
export { default as Props } from "./automated/props";
export { default as TokensOld } from "./automated/tokens.old";
export { default as TokenKategori } from "./automated/tokens";
export { default as KodeEksempler } from "./automated/kode-eksempler";
export {
Color,
default as ColorCategories,
} from "./automated/color-categories";
export { default as Frontpage } from "./frontpage";
export { default as Navigation, ds_header_heading } from "./navigation";
@@ -1,129 +0,0 @@
export default {
name: "ds_navigation",
title: "Navigation",
type: "document",
fields: [
{
title: "Designsystem navigajsons-struktur",
name: "title",
type: "string",
readOnly: true,
hidden: true,
initialValue: "Designsystem navigajsons-struktur",
},
{
name: "headings",
title: "Header linker",
type: "array",
of: [
{
type: "ds_navigation_heading",
name: "heading",
title: "Header link",
},
],
validation: (Rule) =>
Rule.required()
.min(1)
.error("Headingmenyen må ha minst en koblet lenke i sidemenyen"),
},
],
};
export const ds_header_heading = {
name: "ds_navigation_heading",
title: "Header link",
type: "object",
fields: [
{
name: "title",
title: "Heading tittel",
type: "string",
validation: (Rule) =>
Rule.required().error("Header lenken må ha en tittel"),
},
{
title: "Side selve headingen linker til",
description:
"Husk å legge denne til i menyen også, hvis ikke blir den bare tilgjengelig via headern",
name: "link_ref",
type: "reference",
to: [{ type: "komponent_artikkel" }, { type: "ds_artikkel" }],
validation: (Rule) =>
Rule.required().error("Header lenken må linke til en startside"),
},
{
title: "Meny for denne headingen",
name: "menu",
type: "array",
validation: (Rule) =>
Rule.required().error("Sidemeny må ha misnt en lenke"),
of: [
{
title: "Menypunkt",
name: "item",
type: "object",
fields: [
{
title: "Menypunkt tittel",
name: "title",
type: "string",
validation: (Rule) =>
Rule.required().error("Sidemeny-lenken må ha en tittel"),
},
{
title: "Link til side",
name: "link",
type: "reference",
to: [{ type: "komponent_artikkel" }, { type: "ds_artikkel" }],
options: {
modal: {
type: "dialog",
width: "medium", // 'small' | 'medium' | 'large' | 'full'
},
},
validation: (Rule) =>
Rule.required().error("Sidemeny-lenken må lenke til en side"),
},
],
},
{
title: "Subheading",
name: "subheading",
type: "object",
fields: [
{
title: "Subheading",
name: "title",
type: "string",
validation: (Rule) =>
Rule.required().error("Subheading må være fylt ut"),
},
],
preview: {
select: {
title: "title",
},
prepare(selection) {
const { title } = selection;
return {
title: title,
subtitle: "Subheading",
};
},
},
},
],
},
],
preview: {
select: {
title: "title",
},
prepare({ title }) {
return {
title: `${title}`,
};
},
},
};
@@ -0,0 +1,56 @@
import {
defaultDocPreview,
editorField,
groups,
innholdFieldNew,
publishedAtField,
sanitySlug,
titleField,
} from "@/lib";
const prefix = "designsystem/side/";
export default {
title: "Artikkel",
name: "ds_artikkel",
type: "document",
groups,
...defaultDocPreview,
fields: [
publishedAtField,
editorField,
titleField,
sanitySlug(prefix, 3),
{
title: "url (v2)",
name: "slug_v2",
type: "slug",
hidden: ({ currentUser }) =>
!currentUser.roles.find((x) => x.name === "developer"),
},
{
title: "Kategori",
name: "kategori",
type: "string",
validation: (Rule) => Rule.required(),
options: {
list: [
{ title: "Styling", value: "styling" },
{ title: "Tokens", value: "tokens" },
{ title: "Stæsj", value: "staesj" },
{ title: "Guider", value: "guider" },
].map((x) => ({
title: x.title,
value: x.value,
})),
layout: "radio",
},
hidden: ({ currentUser }) =>
!currentUser.roles.find((x) => x.name === "developer"),
},
{
...innholdFieldNew,
type: "riktekst_ds_artikkel",
},
],
};
@@ -1,3 +1,5 @@
// MIGRERT
import { People } from "@navikt/ds-icons";
import React from "react";
import profilePage from "../../components/profile/profile-page";
@@ -3,7 +3,6 @@ import {
editorField,
groups,
innholdFieldNew,
migratedField,
publishedAtField,
sanitySlug,
titleField,
@@ -22,6 +21,31 @@ export default {
editorField,
titleField,
sanitySlug(prefix, 3),
{
title: "url (v2)",
name: "slug_v2",
type: "slug",
hidden: ({ currentUser }) =>
!currentUser.roles.find((x) => x.name === "developer"),
},
{
title: "Kategori",
name: "kategori",
type: "string",
validation: (Rule) => Rule.required(),
options: {
list: [
{ title: "Core", value: "core" },
{ title: "Internal", value: "internal" },
].map((x) => ({
title: x.title,
value: x.value,
})),
layout: "radio",
},
hidden: ({ currentUser }) =>
!currentUser.roles.find((x) => x.name === "developer"),
},
{
title: "Metadata",
name: "status",
@@ -63,7 +87,7 @@ export default {
{
...innholdFieldNew,
type: "riktekst_komponent",
name: "bruk_tab",
name: "content",
title: "Innhold",
},
{
@@ -1,144 +1,121 @@
import { Expand, Link } from "@navikt/ds-icons";
import React from "react";
const config = require("../../config");
const maxDepth = 2;
const checkDepth = (list, depth) => {
if (!list || list.length === 0) {
throw new Error("Dropdown lister må ha mist et element");
}
if (depth > maxDepth) {
throw new Error(`Sidemeny kan ha maks dybde på ${maxDepth} elementer`);
}
for (const el of list) {
el._type === "dropdown" && checkDepth(el.dropdown, depth + 1);
}
return true;
};
function validateNestedDepth(sidemenu) {
if (!sidemenu) {
return "Sidemeny må ha minst et element";
}
try {
checkDepth(sidemenu, 0);
} catch (e) {
return e.message;
}
return true;
}
export default {
name: "navigation",
name: "ds_navigation",
title: "Navigation",
type: "document",
fields: [
{
title: "Designsystem navigajsons-struktur",
name: "title",
title: "Tittel",
type: "string",
readOnly: true,
hidden: true,
initialValue: "Designsystem navigajsons-struktur",
},
{
name: "sidemenu",
title: "Sidemeny",
name: "headings",
title: "Header linker",
type: "array",
of: [
{
type: "ds_navigation_heading",
name: "heading",
title: "Header link",
},
],
validation: (Rule) =>
Rule.required()
.min(1)
.error("Headingmenyen må ha minst en koblet lenke i sidemenyen"),
},
],
};
export const ds_header_heading = {
name: "ds_navigation_heading",
title: "Header link",
type: "object",
fields: [
{
name: "title",
title: "Heading tittel",
type: "string",
validation: (Rule) =>
Rule.required().error("Header lenken må ha en tittel"),
},
{
title: "Side selve headingen linker til",
description:
"Linker eller dropdowns med linker. Maks dybde på 2 dropdowns er støttet. Sider må være publisert før de kan linkes her.",
type: "array",
of: [
{ type: "navigation_dropdown", name: "dropdown", title: "Dropdown" },
{ type: "navigation_link", name: "link", title: "Link" },
],
validation: (Rule) => Rule.required().min(1),
},
],
validation: (Rule) =>
Rule.required().custom(({ sidemenu, ...rest }) => {
return validateNestedDepth(sidemenu);
}),
};
export const dropdown = {
name: "navigation_dropdown",
title: "Dropdown",
type: "object",
fields: [
{
name: "title",
title: "Tittel",
type: "string",
validation: (Rule) => Rule.required(),
},
{
title: "Meny",
name: "dropdown",
type: "array",
of: [
{ type: "navigation_link", name: "link", title: "Link" },
{ type: "navigation_dropdown", name: "dropdown", title: "Dropdown" },
],
validation: (Rule) => Rule.required().min(1),
},
],
preview: {
select: {
title: "title",
},
prepare({ title }) {
return {
title: `${title}`,
media: <Expand />,
};
},
},
};
export const link = {
name: "navigation_link",
title: "Link",
type: "object",
fields: [
{
name: "title",
title: "Tittel",
type: "string",
validation: (Rule) => Rule.required(),
},
{
title: "Link",
"Husk å legge denne til i menyen også, hvis ikke blir den bare tilgjengelig via headern",
name: "link_ref",
type: "reference",
weak: true,
to: [{ type: "komponent_artikkel" }, { type: "ds_artikkel" }],
validation: (Rule) => Rule.required(),
/* Matches results based on document prefix */
options: {
filter: ({ document }) => {
const match = config.teams.find((team) =>
document._id.endsWith(team.name)
);
if (!match) {
return {
filter: ``,
};
}
return {
filter: `_type match ["${match.prefix}_*", "*_page"]`,
};
validation: (Rule) =>
Rule.required().error("Header lenken må linke til en startside"),
},
{
title: "Meny for denne headingen",
name: "menu",
type: "array",
validation: (Rule) =>
Rule.required().error("Sidemeny må ha misnt en lenke"),
of: [
{
title: "Menypunkt",
name: "item",
type: "object",
fields: [
{
title: "Menypunkt tittel",
name: "title",
type: "string",
validation: (Rule) =>
Rule.required().error("Sidemeny-lenken må ha en tittel"),
},
{
title: "Link til side",
name: "link",
type: "reference",
to: [{ type: "komponent_artikkel" }, { type: "ds_artikkel" }],
options: {
modal: {
type: "dialog",
width: "medium", // 'small' | 'medium' | 'large' | 'full'
},
},
validation: (Rule) =>
Rule.required().error("Sidemeny-lenken må lenke til en side"),
},
],
},
},
{
title: "Subheading",
name: "subheading",
type: "object",
fields: [
{
title: "Subheading",
name: "title",
type: "string",
validation: (Rule) =>
Rule.required().error("Subheading må være fylt ut"),
},
],
preview: {
select: {
title: "title",
},
prepare(selection) {
const { title } = selection;
return {
title: title,
subtitle: "Subheading",
};
},
},
},
],
},
],
options: {
modal: {
type: "dialog",
width: "medium", // 'small' | 'medium' | 'large' | 'full'
},
},
preview: {
select: {
title: "title",
@@ -146,7 +123,6 @@ export const link = {
prepare({ title }) {
return {
title: `${title}`,
media: <Link />,
};
},
},
@@ -5,7 +5,6 @@ import {
ingressField,
innholdFieldPrinsipp,
isSlugUnique,
migratedField,
prinsipper,
publishedAtField,
SEOFields,
@@ -138,6 +137,5 @@ export default {
ingressField,
innholdFieldPrinsipp,
SEOFields,
migratedField,
],
};
@@ -2,7 +2,6 @@ import {
defaultDocPreview,
groups,
innholdFieldNew,
migratedField,
publishedAtField,
sanitySlug,
titleField,
@@ -21,6 +20,5 @@ export default {
titleField,
sanitySlug(prefix, 2),
innholdFieldNew,
migratedField,
],
};
@@ -11,7 +11,10 @@ export default {
name: "title",
type: "string",
group: "innhold",
validation: (Rule) => Rule.required().error("Temaet må ha et navn"),
validation: (Rule) =>
Rule.required()
.warning("Denne endringe påvirker URL")
.error("Temaet må ha et navn"),
},
{
title: "Kort Intro/Oppsummering",
@@ -30,6 +33,36 @@ export default {
type: "riktekst_enkel",
group: "innhold",
},
{
title: "Hidden",
name: "bruk_seksjoner",
type: "boolean",
hidden: true,
},
{
title: "Shortname",
description: "En mer sanitert visning av tema-navnet i url ene",
name: "slug",
type: "slug",
group: "innhold",
validation: (Rule) => Rule.required().error("Tema må ha en URL"),
options: {
source: "title",
slugify: (s: string) =>
s
? s
.toLowerCase()
.trim()
.replace(/\s+/g, "-")
.replace(/-+/gm, "-")
.replace(/æ/g, "a")
.replace(/å/g, "a")
.replace(/ø/g, "o")
// eslint-disable-next-line no-useless-escape
.replace(/[&\\#!,+()$~%.'"¨:*?<>{}]/g, "")
: "",
},
},
{
title: "Ansvarlig for tema",
description: "Legg til redaktør som har forvaltningsansvaret for temaet",
@@ -39,15 +72,6 @@ export default {
validation: (Rule) => Rule.required(),
group: "innhold",
},
{
title: "Bruk seksjonsinndeling",
description:
"Vil ikke vise artikler som ikke er lagt til i seksjoner hvis valgt!",
name: "bruk_seksjoner",
type: "boolean",
group: "innhold",
initialValue: false,
},
{
title: "Seksjonering",
description:
@@ -55,7 +79,6 @@ export default {
name: "seksjoner",
type: "array",
group: "innhold",
hidden: ({ parent }) => !parent?.bruk_seksjoner,
of: [
{
type: "object",
+7 -6
View File
@@ -1,28 +1,28 @@
import Accordion from "./accordion";
import Alert from "./alert";
import Innholdskort from "./innholdskort";
import Bilde from "./bilde";
import HeroBilde from "./hero-bilde";
import DoDont, { doDontBlock } from "./do-dont";
import HeroBilde from "./hero-bilde";
import introKomponent from "./intro-komponent";
import Kode from "./kode";
import KodeEksempler from "./kode-eksempler";
import Props from "./props";
import RelatertInnhold from "./relatert-innhold";
import Innholdskort from "./innholdskort";
import KodeEksempler from "./kode-eksempler";
import TokenRef from "./token-tabell";
import { tmpTabell, tmpTabellRow } from "./tabellv2";
import {
RiktekstAksel,
RiktekstDsArtikkel,
RiktekstEnkel,
RiktekstKomponent,
RiktekstTabell,
RiktekstPrinsipp,
RiktekstTabell,
} from "./riktekst";
import SpesialSeksjon from "./spesial-seksjon";
import Tastatur from "./tastatur";
import Tips from "./tips";
import TokenRef from "./token-tabell";
import Video from "./video";
import { tmpTabell, tmpTabellRow } from "./tabellv2";
const v2Blocks = [
tmpTabell,
@@ -36,6 +36,7 @@ const v2Blocks = [
RiktekstPrinsipp,
/* Moduler */
/* Tabellv2, */
DoDont,
doDontBlock,
Bilde,
@@ -1,3 +1,5 @@
// Usikker på om skal være med videre
import { FileContent } from "@navikt/ds-icons";
import React from "react";
@@ -22,7 +22,7 @@ export default {
initialValue: false,
},
{
title: "Installasjon-snippet",
title: "Eksempel-navn",
name: "dir",
type: "reference",
to: [{ type: "kode_eksempler_fil" }],
@@ -1,3 +1,5 @@
// MIGRERT
import React from "react";
export default {
@@ -1,3 +1,5 @@
// MIGRERT
import { List } from "@navikt/ds-icons";
import React from "react";
@@ -1,3 +1,5 @@
// MIGRERT
import { allDocumentTypes } from "../../config";
import { Link } from "@navikt/ds-icons";
import React from "react";
@@ -2,7 +2,7 @@ import { Star } from "@navikt/ds-icons";
import React from "react";
export default {
title: "Sidemodul",
title: "Unik Sidemodul",
type: "object",
name: "spesial_seksjon",
icon: Star,
@@ -14,26 +14,13 @@ export default {
type: "string",
options: {
list: [
{ title: "Farge kategori", value: "farge_kategori" },
{ title: "Token kategori", value: "token_kategori" },
{ title: "Ikonsøk", value: "ikonsok" },
{ title: "Endringslogg", value: "endringslogg" },
{ title: "Komponentoversikt", value: "komponentoversikt" },
/* ...Object.keys(docs).map((x) => ({
title: `Tokenvisning: ${x}`,
value: `tokens_${x}`,
})), */
],
layout: "radio",
},
},
{
title: "Farge kategori",
type: "reference",
name: "farge_ref",
hidden: ({ parent }) => parent.modul !== "farge_kategori",
to: [{ type: "ds_color_categories" }],
},
{
title: "Token kategori",
type: "reference",
@@ -49,7 +36,7 @@ export default {
prepare(s) {
return {
title: s.modul,
subtitle: "Sidemodul",
subtitle: "Unik Sidemodul",
media: () => <Star />,
};
},
+27 -23
View File
@@ -4,12 +4,22 @@ import schemaTypes from "all:part:@sanity/base/schema-type";
/* Schemas */
/* Documents */
import editors from "./documents/editors";
import navigation, { dropdown, link } from "./documents/navigation";
import frontpage from "./documents/frontpage";
import redirect from "./documents/redirects";
import KodeEksempler from "./documents/kode-eksempler";
import Tokens from "./documents/tokens";
import Props from "./documents/props";
import DsFrontpage from "./documents/ds-frontpage";
import DsCompTemplate from "./documents/component-template";
import KompArtikkel from "./documents/komponent";
import AkselTema from "./documents/tema";
import AkselArtikkel from "./documents/aksel-artikkel";
import DsArtikkel from "./documents/ds-artikkel";
import Blogg from "./documents/blogg";
import Prinsipp from "./documents/prinsipp";
import Standalone from "./documents/standalone";
import Navigation, { ds_header_heading } from "./documents/navigation";
import * as Designsystem from "./documents/designsystem";
import * as Aksel from "./documents/aksel";
import v2Blocks from "./modules";
export default createSchema({
@@ -18,28 +28,22 @@ export default createSchema({
...v2Blocks,
frontpage,
editors,
navigation,
link,
dropdown,
redirect,
Navigation,
ds_header_heading,
KompArtikkel,
Designsystem.Color,
Designsystem.ds_header_heading,
Designsystem.ColorCategories,
Designsystem.TokensOld,
Designsystem.TokenKategori,
Designsystem.KodeEksempler,
Designsystem.Props,
Designsystem.ComponentTemplate,
Designsystem.Frontpage,
Designsystem.Navigation,
Designsystem.KomponentArtikkel,
Designsystem.Artikkel,
KodeEksempler,
Tokens,
Props,
DsFrontpage,
DsCompTemplate,
DsArtikkel,
Aksel.Artikkel,
Aksel.Blogg,
Aksel.Tema,
Aksel.Prinsipp,
Aksel.Standalone,
AkselArtikkel,
Blogg,
AkselTema,
Prinsipp,
Standalone,
]),
});
+3 -1
View File
@@ -7,6 +7,8 @@ if (!sanityToken) {
throw new Error("Could not find token from SANITY_TOKEN");
}
console.log(sanityToken);
const client = sanityClient({
projectId: SanityConfig.api.projectId,
dataset: SanityConfig.api.dataset,
@@ -45,4 +47,4 @@ const main = async () => {
});
};
main();
/* main(); */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,22 @@
import { definePreview } from "next-sanity/preview";
import { ComponentType } from "react";
import { config } from "../lib/sanity/config";
const usePreview = definePreview(config);
const WithPreview = ({
comp: Comp,
query,
params,
props,
}: {
comp: ComponentType;
query: string;
props: any;
params?: any;
}) => {
const data = usePreview(null, query, params);
return <Comp {...props} {...data} />;
};
export default WithPreview;
@@ -4,7 +4,6 @@ import { SanityT } from "@/lib";
import AkselArtikkelTemplate from "./page-templates/AkselArtikkel";
import AkselBloggTemplate from "./page-templates/AkselBlogg";
import ArtikkelTemplate from "./page-templates/Artikkel";
import ArtikkelTabbedTemplate from "./page-templates/ArtikkelTabbed";
import KomponentArtikkelTemplate from "./page-templates/KomponentArtikkel";
import AkselPrinsippTemplate from "./page-templates/AkselPrinsipp";
import AkselStandaloneTemplate from "./page-templates/AkselStandalone";
@@ -61,12 +60,7 @@ type templateT =
const templates: templateT = {
komponent_artikkel: (props) => <KomponentArtikkelTemplate {...props} />,
ds_artikkel: (props) =>
props.data.artikkel_type ? (
<ArtikkelTabbedTemplate {...props} />
) : (
<ArtikkelTemplate {...props} />
),
ds_artikkel: (props) => <ArtikkelTemplate {...props} />,
aksel_artikkel: (props) => <AkselArtikkelTemplate {...props} />,
aksel_blogg: (props) => <AkselBloggTemplate {...props} />,
aksel_prinsipp: (props) => <AkselPrinsippTemplate {...props} />,
@@ -26,14 +26,14 @@ const Footer = ({ variant = "ds" }: { variant: "ds" | "aksel" }) => {
</Heading>
<BodyShort as="ul" className="mt-5 grid gap-2">
<li>
<NextLink href="/artikkel/om-aksel" passHref>
<NextLink href="/god-praksis/artikler/om-aksel" passHref>
<Link className="text-text-on-inverted focus:shadow-focus focus:text-text-default focus:bg-blue-200 focus:shadow-blue-200">
Om Aksel
</Link>
</NextLink>
</li>
<li>
<NextLink href="/artikkel/skriv-for-aksel" passHref>
<NextLink href="/god-praksis/artikler/skriv-for-aksel" passHref>
<Link className="text-text-on-inverted focus:shadow-focus focus:text-text-default focus:bg-blue-200 focus:shadow-blue-200">
Skriv for Aksel
</Link>
@@ -1,10 +1,11 @@
import { getTemaSlug, SanityT, urlFor } from "@/lib";
import { SanityT, urlFor } from "@/lib";
import { SanityBlockContent } from "@/sanity-block";
import { Next } from "@navikt/ds-icons";
import { BodyShort, Heading, Ingress, Label } from "@navikt/ds-react";
import { FooterSlope } from "components/website-modules/Slope";
import Head from "next/head";
import NextLink from "next/link";
import {
abbrName,
ArtikkelCard,
@@ -42,7 +43,7 @@ const AkselArtikkelTemplate = ({
</Heading>
<div className="card-grid-3-1 mt-6 px-4">
{data.relevante_artikler.map((x: any) => (
<ArtikkelCard {...x} source={x.title} key={x._id} />
<ArtikkelCard {...x} key={x._id} />
))}
</div>
</div>
@@ -110,11 +111,11 @@ const AkselArtikkelTemplate = ({
</div>
{hasTema && (
<div className="mt-8 flex flex-wrap gap-2">
{data.tema.map(({ title }: any) => (
{data.tema.map(({ title, slug }: any) => (
<span key={title}>
<NextLink
key={title}
href={`/tema/${getTemaSlug(title)}`}
href={`/god-praksis/${slug.current}`}
passHref
>
<BodyShort
@@ -2,6 +2,7 @@ import { SanityT, urlFor } from "@/lib";
import { SanityBlockContent } from "@/sanity-block";
import { BodyShort, Heading, Ingress, Label } from "@navikt/ds-react";
import Head from "next/head";
import { abbrName, dateStr, Feedback, TableOfContents } from "../..";
import Footer from "../footer/Footer";
import AkselHeader from "../header/AkselHeader";
@@ -3,7 +3,6 @@ import { SanityT } from "@/lib";
import { SanityBlockContent } from "@/sanity-block";
import { Heading } from "@navikt/ds-react";
import Head from "next/head";
import React from "react";
import Footer from "../footer/Footer";
import AkselHeader from "../header/AkselHeader";
@@ -33,7 +32,7 @@ const AkselStandaloneTemplate = ({
<main
tabIndex={-1}
id="hovedinnhold"
className="aksel-artikkel bg-gray-50 pt-[8vw] pb-16 focus:outline-none xs:pb-32"
className="aksel-artikkel xs:pb-32 bg-gray-50 pt-[8vw] pb-16 focus:outline-none"
>
<div className="px-4">
<div className="dynamic-wrapper-prose">
@@ -1,8 +1,8 @@
import { SanityT } from "@/lib";
import { SanityBlockContent } from "@/sanity-block";
import { BodyShort, Heading } from "@navikt/ds-react";
import cl from "classnames";
import Head from "next/head";
import { dateStr, Feedback, TableOfContents } from "../..";
const ArtikkelTemplate = ({
@@ -16,11 +16,6 @@ const ArtikkelTemplate = ({
return null;
}
const layout = cl({
"content-box--full": data.layout === "full",
"content-box": data.layout !== "full",
});
return (
<>
<Head>
@@ -31,6 +26,7 @@ const ArtikkelTemplate = ({
</>
)}
</Head>
<div className="content-box">
<div className="pt-8 pb-6">
<Heading
@@ -53,7 +49,7 @@ const ArtikkelTemplate = ({
</div>
<div className="relative flex max-w-full md:max-w-7xl">
<TableOfContents changedState={data.content} hideToc={false} />
<div className={layout}>
<div className="content-box">
<SanityBlockContent className="mt-12" blocks={data.content} />
<Feedback docId={data?._id} docType={data?._type} />
</div>
@@ -1,104 +0,0 @@
import { SanityT } from "@/lib";
import { SanityBlockContent } from "@/sanity-block";
import { BodyShort, Heading, Tabs } from "@navikt/ds-react";
import Head from "next/head";
import { useRouter } from "next/router";
import { capitalize, dateStr, Feedback, logNav, TableOfContents } from "../..";
const ArtikkelTabbedTemplate = ({
data,
title,
}: {
data: SanityT.Schema.ds_artikkel;
title: string;
}): JSX.Element => {
const { query, push } = useRouter();
if (!data.content_tabs || !data.heading) {
return null;
}
const basePath = `/designsystem/side/${query.slug[1]}`;
const tabs: string[] = data.content_tabs.map(
(tab) => tab.title?.toLowerCase().replace(/\s+/g, "-") || "undefined"
);
const activeTab = query.slug[2] ? tabs.indexOf(query.slug[2]) : 0;
const tabTitle = data?.content_tabs?.[activeTab]?.title;
return (
<>
<Head>
{data.heading && (
<>
<title>{`${data.heading} ${tabTitle ?? ""} - ${title}`}</title>
<meta property="og:title" content={`${data.heading} - ${title}`} />
</>
)}
</Head>
<div className="content-box">
<div className="pt-8 pb-6">
<Heading
size="xlarge"
level="1"
spacing
className="algolia-index-lvl1"
>
{data.heading}
</Heading>
<BodyShort
size="small"
as="span"
className="text-text-subtle flex items-center"
>
{`Oppdatert ${dateStr(data._updatedAt)}`}
</BodyShort>
</div>
</div>
{tabs.length > 1 && (
<Tabs
className="top-0 z-[1001]"
value={data.content_tabs[activeTab]?.title
.toLowerCase()
.replace(/\s+/g, "-")}
onChange={(x) => {
push(`${basePath}/${x}`, undefined, { shallow: true });
logNav("tabs", window.location.pathname, `${basePath}/${x}`);
}}
>
<Tabs.List className="mx-0 px-2 md:mx-12 md:px-0">
{data.content_tabs.map((x) => (
<Tabs.Tab
as="button"
key={x.title}
value={x.title?.toLowerCase().replace(/\s+/g, "-")}
label={capitalize(x.title)}
/>
))}
</Tabs.List>
{data.content_tabs.map((x) => (
<Tabs.Panel
className="tabpanel relative max-w-full md:max-w-7xl"
key={x.title}
value={x.title?.toLowerCase().replace(/\s+/g, "-")}
>
<TableOfContents changedState={x.content} hideToc={false} />
<div className="content-box">
<SanityBlockContent className="mt-12" blocks={x.content} />
<Feedback docId={data?._id} docType={data?._type} />
</div>
</Tabs.Panel>
))}
</Tabs>
)}
<style jsx global>{`
.tabpanel[data-state="active"] {
display: flex;
}
`}</style>
</>
);
};
export default ArtikkelTabbedTemplate;
@@ -55,7 +55,6 @@ const KomponentArtikkelTemplate = ({
content={`${data.heading} - Designsystemet`}
/>
</Head>
<div className="content-box">
<div className="pt-8">
<div className="flex flex-wrap gap-2"></div>
@@ -123,7 +122,7 @@ const KomponentArtikkelTemplate = ({
</div>
</div>
<div className="relative flex max-w-full md:max-w-7xl">
<TableOfContents changedState={data["bruk_tab"]} hideToc={false} />
<TableOfContents changedState={data["content"]} hideToc={false} />
<div className="content-box">
<div className="mt-12">
{data?.status && data.status?.tag === "beta" && (
@@ -133,8 +132,9 @@ const KomponentArtikkelTemplate = ({
</Heading>
<BodyLong className="override-text-no-max mb-2">
Komponenten er under utvikling. Dette kan medføre
breaking-changes i patch/minor versjon av kodepakker. Vær
forsiktig ved bruk og unngå production om mulig.
breaking-changes i patch/minor versjon av kodepakker. Teamet
ditt må selv ta stilling til om dere ønsker å bruke denne i
produksjon.
</BodyLong>
<BodyLong className="override-text-no-max">
Har du innspill eller funnet en bug? Send oss en melding her
@@ -144,7 +144,7 @@ const KomponentArtikkelTemplate = ({
</div>
)}
<IntroSeksjon node={data.intro} />
<SanityBlockContent blocks={data["bruk_tab"]} />
<SanityBlockContent blocks={data["content"]} />
</div>
<Feedback docId={data?._id} docType={data?._type} />
</div>
@@ -12,12 +12,7 @@ const IconSearch = dynamic(() => import("./icon-search"), {
type SpesialT = {
_key: string;
_type: "spesial_seksjon";
modul?:
| "farge_kategori"
| "ikonsok"
| "endringslogg"
| "komponentoversikt"
| "token_kategori";
modul?: "ikonsok" | "komponentoversikt" | "token_kategori";
logs?: any[];
komponenter?: any;
farge?: any;
@@ -31,8 +26,6 @@ const SideModul = ({ node }: { node: SpesialT }): JSX.Element => {
const GetModule = () => {
switch (node.modul) {
case "farge_kategori":
return null;
case "komponentoversikt":
return <ComponentOverview node={node.komponenter} />;
case "ikonsok":
@@ -1,4 +1,4 @@
import { getTemaSlug, SanityT } from "@/lib";
import { SanityT } from "@/lib";
import { BodyShort, Detail, Heading } from "@navikt/ds-react";
import NextLink from "next/link";
import { abbrName, dateStr, logNav } from "../..";
@@ -23,7 +23,7 @@ export const ArtikkelCard = ({
href={{
pathname: `/${slug}`,
query: {
...(source ? { tema: getTemaSlug(source) } : {}),
...(source ? { tema: source } : {}),
},
}}
passHref
@@ -1,4 +1,3 @@
import { getTemaSlug } from "@/lib";
import { BodyShort, Heading } from "@navikt/ds-react";
import NextLink from "next/link";
import { logNav } from "../..";
@@ -9,11 +8,12 @@ export const TemaCard = ({
title,
refCount,
compact = false,
}: AkselTemaT & { compact?: boolean }) => {
slug,
}: AkselTemaT & { compact?: boolean; urlPrefix?: string }) => {
return (
<NextLink href={`/tema/${getTemaSlug(title)}`} passHref>
<NextLink href={`/god-praksis/${slug.current}`} passHref>
<a
className="group relative rounded-r-md rounded-l bg-white shadow transition-colors ease-in-out focus:outline-none focus-visible:shadow-focus sm:shadow-md"
className="focus-visible:shadow-focus group relative rounded-r-md rounded-l bg-white shadow transition-colors ease-in-out focus:outline-none sm:shadow-md"
onClick={(e) =>
logNav(
"temakort",
@@ -1,35 +1,10 @@
/* eslint-disable @next/next/no-img-element */
import { SanityT, urlFor } from "@/lib";
import { Heading, Tag } from "@navikt/ds-react";
import { Heading } from "@navikt/ds-react";
import Nextlink from "next/link";
import cl from "classnames";
const getStatus = (status?: SanityT.Schema.komponent_artikkel["status"]) => {
switch (status?.tag) {
case "beta":
return (
<Tag variant="alt1" size="small">
Beta
</Tag>
);
case "new":
return (
<Tag variant="info" size="small">
New
</Tag>
);
case "ready":
return null;
case "deprecated":
return (
<Tag variant="neutral" size="small">
Deprecated
</Tag>
);
default:
return null;
}
};
import Image from "next/image";
import { StatusTag } from "components/website-modules/StatusTag";
const ComponentOverview = ({
node,
@@ -38,7 +13,6 @@ const ComponentOverview = ({
_id: string;
heading: string;
slug: { current: string };
ingress?: any[];
status?: SanityT.Schema.komponent_artikkel["status"];
}[];
}): JSX.Element => {
@@ -60,49 +34,63 @@ const ComponentOverview = ({
<ul className="component-card-grid">
{sorted.map((x) => (
<li key={x._id}>
<div className="shadow-small focus-within:shadow-focus hover:shadow-medium group relative rounded ring-1 ring-gray-900/10">
<div className="bg-surface-subtle focus-within:shadow-focus ring-border-subtle hover:shadow-medium group relative h-56 rounded-2xl hover:ring-1">
<div
className={cl(
"flex max-h-64 items-center justify-center overflow-hidden rounded-t bg-gray-50",
{
"p-12":
x.status?.bilde &&
!urlFor(x.status?.bilde)
.auto("format")
.url()
.includes("320x256.svg?auto=format"),
}
"flex max-h-44 items-center justify-center overflow-hidden rounded-t-2xl"
)}
>
{x.status?.bilde ? (
<img
alt={x?.heading + " thumbnail"}
decoding="async"
<Image
src={urlFor(x.status?.bilde).auto("format").url()}
className="object-contain transition-transform"
decoding="async"
width="200px"
height="200px"
layout="fixed"
objectFit="contain"
alt={x?.heading + " thumbnail"}
aria-hidden
/>
) : (
<svg
aria-hidden
width="200"
height="200"
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="-11.5 -10.23174 23 20.46348"
className="min-h-40 aspect-[1.25/1] h-auto max-h-64 p-4"
aria-hidden
>
<title>React Logo</title>
<circle cx="0" cy="0" r="2.05" fill="var(--a-gray-300)" />
<g stroke="var(--a-gray-300)" strokeWidth="1" fill="none">
<ellipse rx="11" ry="4.2" />
<ellipse rx="11" ry="4.2" transform="rotate(60)" />
<ellipse rx="11" ry="4.2" transform="rotate(120)" />
</g>
<path
fill="#3380A5"
d="M85 75h5v5h-5zM80 80h5v5h-5zM60 65h5v5h-5zM65 60h5v5h-5zM70 60h5v5h-5zM75 60h5v5h-5zM80 60h5v5h-5zM85 60h5v5h-5zM90 60h5v5h-5zM95 60h5v5h-5zM100 60h5v5h-5zM105 60h5v5h-5zM110 60h5v5h-5zM115 60h5v5h-5zM120 60h5v5h-5zM125 60h5v5h-5zM130 60h5v5h-5zM60 70h5v5h-5zM60 75h5v5h-5zM60 80h5v5h-5zM60 85h5v5h-5zM60 90h5v5h-5zM60 95h5v5h-5zM60 100h5v5h-5zM60 105h5v5h-5zM60 110h5v5h-5zM60 115h5v5h-5zM60 120h5v5h-5zM60 125h5v5h-5zM60 130h5v5h-5zM80 85h5v5h-5zM80 90h5v5h-5zM85 80h5v5h-5zM85 85h5v5h-5zM85 90h5v5h-5zM105 80h5v5h-5zM105 85h5v5h-5zM105 90h5v5h-5zM105 95h5v5h-5zM100 95h5v5h-5zM100 100h5v5h-5zM100 105h5v5h-5zM100 115h5v5h-5zM100 120h5v5h-5zM95 100h5v5h-5zM95 105h5v5h-5zM95 115h5v5h-5zM95 120h5v5h-5zM110 80h5v5h-5zM110 85h5v5h-5zM110 90h5v5h-5zM110 95h5v5h-5zM90 75h5v5h-5zM95 75h5v5h-5zM100 75h5v5h-5zM105 75h5v5h-5z"
/>
<path
fill="#00243A"
d="M70 70h5v5h-5zM90 80h5v5h-5zM90 85h5v5h-5zM90 90h5v5h-5zM90 95h5v5h-5zM85 95h5v5h-5zM95 80h5v5h-5zM100 80h5v5h-5zM115 85h5v5h-5zM115 90h5v5h-5zM115 95h5v5h-5zM115 100h5v5h-5zM110 100h5v5h-5zM105 100h5v5h-5zM105 105h5v5h-5zM105 110h5v5h-5zM105 120h5v5h-5zM105 125h5v5h-5zM125 125h5v5h-5zM100 125h5v5h-5zM70 125h5v5h-5zM100 110h5v5h-5zM125 70h5v5h-5zM135 65h5v5h-5zM135 70h5v5h-5zM135 75h5v5h-5zM135 80h5v5h-5zM135 85h5v5h-5zM135 90h5v5h-5zM135 95h5v5h-5zM135 100h5v5h-5zM135 105h5v5h-5zM135 110h5v5h-5zM135 115h5v5h-5zM135 120h5v5h-5zM135 125h5v5h-5zM135 130h5v5h-5zM135 135h5v5h-5zM130 135h5v5h-5zM125 135h5v5h-5zM120 135h5v5h-5zM115 135h5v5h-5zM110 135h5v5h-5zM105 135h5v5h-5zM100 135h5v5h-5zM95 135h5v5h-5zM90 135h5v5h-5zM85 135h5v5h-5zM80 135h5v5h-5zM75 135h5v5h-5zM70 135h5v5h-5zM65 135h5v5h-5zM60 135h5v5h-5z"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M65 65h70v70H65V65Zm65 5h-5v5h5v-5Zm0 60v-5h-5v5h5Zm-20 0v-10h-5v-5h5v-10h10V85h-5v-5h-5v-5H85v5h-5v15h5v5h10v10h5v5h-5v10h5v5h10Zm-15-30V85h10v10h-5v5h-5ZM75 75v-5h-5v5h5Zm0 55v-5h-5v5h5Z"
fill="url(#a)"
/>
<defs>
<linearGradient
id="a"
x1="65"
y1="65"
x2="135"
y2="135"
gradientUnits="userSpaceOnUse"
>
<stop offset=".010417" stopColor="#CCE2F0" />
<stop offset="1" stopColor="#66A3C4" />
</linearGradient>
</defs>
</svg>
)}
</div>
<div
className={cl("grid p-3", {
"pt-3": !!x?.status?.bilde,
})}
>
<div className="grid p-6 pt-0">
<span className="flex items-center justify-between">
<Nextlink href={`/${x?.slug.current}`} passHref>
<Heading
@@ -111,9 +99,11 @@ const ComponentOverview = ({
className="z-10 before:absolute before:inset-0 focus:outline-none group-hover:underline"
>
{x.heading}
<span className="absolute top-4 left-4">
<StatusTag status={x?.status?.tag} />
</span>
</Heading>
</Nextlink>
{getStatus(x.status)}
</span>
</div>
</div>
@@ -7,13 +7,30 @@ import React, { useCallback, useEffect, useState } from "react";
import Filter, { FilterT } from "./Filter";
import { categorizeIcons, CategoryT, IconMetaT } from "./iconCategories";
const SkeletonElement = () => (
<div className="vk-icon_button bg-surface-subtle h-32 w-48 shrink rounded" />
);
const ModalPlaceholder = () => (
<div className="min-h-96 w-[600px] max-w-[90%]" />
);
const IconView = dynamic(() => import("./IconView"), {
loading: () => <div className="min-h-screen w-full" />,
loading: () => (
<div className="min-h-screen w-full pt-8">
<div className="bg-surface-subtle mb-3 h-5 w-48 rounded-full" />
<div className="grid content-start justify-start gap-x-4 gap-y-6 pb-8 [grid-template-columns:repeat(auto-fit,12rem)]">
{[...Array(24)].map((_, y) => (
<SkeletonElement key={y} />
))}
</div>
</div>
),
ssr: false,
});
const ModalContent = dynamic(() => import("./ModalContent"), {
loading: () => <div className="min-h-[90vw] w-[600px] max-w-[90%]" />,
loading: () => <ModalPlaceholder />,
ssr: false,
});
@@ -150,7 +167,11 @@ const IconSearch = () => {
</BodyLong>
<Modal open={open} onClose={() => handleClose()}>
<Modal.Content>
{selectedIcon && <ModalContent icon={selectedIcon} />}
{selectedIcon ? (
<ModalContent icon={selectedIcon} />
) : (
<ModalPlaceholder />
)}
</Modal.Content>
</Modal>
</div>
@@ -55,6 +55,7 @@ export const CopyToken = ({ val }: { val: string }) => {
"bg-surface-action-selected text-md text-text-on-action flex h-7 w-full px-2 font-sans text-sm",
{ "animate-popup translate-y-[-100%]": copyTimer }
)}
aria-hidden
>
<span
className={cl("flex w-full items-center justify-center gap-1", {
@@ -17,8 +17,8 @@ export const BreadCrumbs = ({
}
return (
<NextLink href={href ?? `/tema/${router.query.tema}`} passHref>
<a className="group mb-1 flex w-fit items-center justify-start text-deepblue-500 hover:text-deepblue-800 focus:underline focus:outline-none">
<NextLink href={href ?? `/god-praksis/${router.query.tema}`} passHref>
<a className="text-deepblue-500 hover:text-deepblue-800 group mb-1 flex w-fit items-center justify-start focus:underline focus:outline-none">
<svg
fill="none"
xmlns="http://www.w3.org/2000/svg"
@@ -33,7 +33,7 @@ export const BreadCrumbs = ({
<path
d="M16 9.72266L8 9.72266"
strokeWidth="1.5"
className="hidden stroke-deepblue-500 group-hover:block group-hover:stroke-deepblue-800"
className="stroke-deepblue-500 group-hover:stroke-deepblue-800 hidden group-hover:block"
/>
</svg>
@@ -1,19 +1,18 @@
/**
* https://github.com/navikt/detsombetyrnoe/blob/main/src/components/PreviewBanner.tsx#L17
*/
import { useCurrentUser } from "@/lib";
import { Edit } from "@navikt/ds-icons";
import { Tooltip } from "@navikt/ds-react";
import * as React from "react";
import { useContext } from "react";
import { IdContext } from "./utils";
import cl from "classnames";
import { useContext } from "react";
import { IdContext, useCheckAuth } from "./utils";
function EditButton({ variant }: { variant: "ds" | "aksel" }): JSX.Element {
const { data } = useCurrentUser();
const idCtx = useContext(IdContext);
return data && idCtx?.id ? (
const validUser = useCheckAuth();
return validUser && idCtx?.id ? (
<>
<div className="overflow-hidden">
<Tooltip
@@ -1,16 +1,15 @@
/**
* https://github.com/navikt/detsombetyrnoe/blob/main/src/components/PreviewBanner.tsx#L17
*/
import { useCurrentUser } from "@/lib";
import { useCheckAuth } from "./utils";
import { BodyShort, Button, Detail } from "@navikt/ds-react";
import { useRouter } from "next/router";
import * as React from "react";
function PreviewBanner(): JSX.Element {
const { asPath } = useRouter();
const { data } = useCurrentUser();
const validUser = useCheckAuth();
if (data === null) {
if (!validUser) {
return (
<>
<div className="fixed inset-0 z-[9999] bg-gray-900/70 backdrop-blur-sm" />
@@ -43,7 +42,6 @@ function PreviewBanner(): JSX.Element {
);
}
if (!data) return null;
return (
<a
href={`/api/exit-preview?slug=${asPath}`}
@@ -0,0 +1,38 @@
import { Tag } from "@navikt/ds-react";
export const StatusTag = ({
status,
showStable = false,
}: {
status: string;
showStable?: boolean;
}) => {
switch (status) {
case "beta":
return (
<Tag variant="alt1" size="small">
Beta
</Tag>
);
case "new":
return (
<Tag variant="info" size="small">
New
</Tag>
);
case "ready":
return showStable ? (
<Tag variant="success" size="small">
Stable
</Tag>
) : null;
case "deprecated":
return (
<Tag variant="neutral" size="small">
Deprecated
</Tag>
);
default:
return null;
}
};
@@ -122,8 +122,9 @@ function Search({
noResultsScreen: {
noResultsText: "Ingen resultater for",
suggestedQueryText: "Prøv disse søkene",
openIssueText: "Bør søket gi et resultat?",
openIssueLinkText: "Send oss en melding, så fikser vi",
reportMissingResultsText: "Bør søket gi et resultat?",
reportMissingResultsLinkText:
"Send oss en melding, så fikser vi",
},
}}
appId="J64I2SIG7K"
@@ -1,6 +1,4 @@
import amplitude from "amplitude-js";
import { isTest } from ".";
import { isDevelopment } from "@/lib";
export enum AmplitudeEvents {
"sidevisning" = "sidevisning",
@@ -43,10 +41,13 @@ export const logNav = (kilde: string, fra: string, til: string) => {
const isPreview = () => !!document.getElementById("exit-preview-id");
const isDevelopment = process.env.NODE_ENV === "development";
const isTest = process.env.NEXT_PUBLIC_TEST === "true";
export function logAmplitudeEvent(eventName: string, data?: any): Promise<any> {
return new Promise(function (resolve: any) {
const eventData = data ? { ...data } : {};
if (amplitude && !(isDevelopment() || isTest() || isPreview())) {
if (amplitude && !(isDevelopment || isTest || isPreview())) {
amplitude.getInstance().logEvent(eventName, eventData, resolve);
}
});
@@ -0,0 +1,3 @@
import { createContext } from "react";
export const IdContext = createContext<{ id?: string }>(null);
@@ -3,6 +3,5 @@ import { PagePropsContextT } from "@/lib";
export const PagePropsContext = createContext<PagePropsContextT>(null);
export const IdContext = createContext<{ id?: string }>(null);
export * from "./authprovider";
export * from "./id-context";
@@ -1,4 +1,6 @@
import { useEffect, useState } from "react";
import { _checkAuth } from "@sanity/preview-kit";
import { config } from "../../../lib/sanity/config";
export const useDebounce = (value: any) => {
const [debouncedValue, setDebouncedValue] = useState(value);
@@ -11,3 +13,13 @@ export const useDebounce = (value: any) => {
return debouncedValue;
};
export const useCheckAuth = () => {
const [user, setUser] = useState<boolean>(true);
useEffect(() => {
_checkAuth(config.projectId, null).then(setUser);
}, []);
return user;
};
@@ -1,7 +1,6 @@
import { useEffect } from "react";
const environment = process.env.NODE_ENV;
const test = process.env.NEXT_PUBLIC_TEST;
export const isProduction = (): boolean => {
if (typeof window !== "undefined") {
@@ -15,10 +14,6 @@ export const isProduction = (): boolean => {
}
};
export function isTest(): boolean {
return test === "true";
}
// https://stackoverflow.com/questions/38588346/anchor-a-tags-not-working-in-chrome-when-using/38588927#38588927
// https://github.com/vercel/next.js/discussions/13134
export function useScrollToHashOnPageLoad(): void {
+6 -7
View File
@@ -1,14 +1,13 @@
[
"/",
"/designsystem",
"/tema",
"/blogg",
"/god-praksis",
"/produktbloggen",
"/designsystem/komponenter/tag",
"/designsystem/side/migrering",
"/designsystem/side/ikoner",
"/tema/innholdsarbeid",
"/tema/brukerinnsikt",
"/tema/universell-utforming",
"/artikkel/innholdsstrategi-for-nav-no?tema=innholdsarbeid",
"/blogg/ny-forside-pa-navno"
"/god-praksis/innholdsarbeid",
"/god-praksis/brukerinnsikt",
"/god-praksis/universell-utforming",
"/god-praksis/artikler/innholdsstrategi-for-nav-no?tema=innholdsarbeid"
]
@@ -58,12 +58,19 @@ const transform = (src: any, type?: string) => {
return newData;
};
/*
const docs = await noCdnClient(token).fetch(
`*[_type in ["komponent_artikkel","ds_artikkel","aksel_artikkel","aksel_prinsipp","aksel_blogg","aksel_standalone"]]`
);
*/
const main = async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const transactionClient = noCdnClient(token).transaction();
const docs = await noCdnClient(token).fetch(
`*[_type in ["komponent_artikkel","ds_artikkel","aksel_artikkel","aksel_prinsipp","aksel_blogg","aksel_standalone"]]`
`*[_type in ["komponent_artikkel"]]`
);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -72,8 +79,6 @@ const main = async () => {
docs.forEach((data) => {
switch (data._type) {
case "aksel_artikkel":
/* data.innhold &&
newData.push({ _id: data._id, content: transform(data.innhold) }); */
break;
case "aksel_prinsipp":
break;
@@ -84,6 +89,11 @@ const main = async () => {
case "ds_artikkel":
break;
case "komponent_artikkel":
/* data.bruk_tab &&
newData.push({
_id: data._id,
content: data.bruk_tab.map((x) => ({ ...x, _key: randKey() })),
}); */
break;
default:
break;
@@ -93,9 +103,10 @@ const main = async () => {
/* for (const data of newData) {
const id = data._id;
delete data._id;
transactionClient.patch(id, (p) => p.set({ ...data }));
} */
/* await transactionClient
transactionClient.patch(id, (p) => p.set({ ...data }).unset(["bruk_tab"]));
}
await transactionClient
.commit({ autoGenerateArrayKeys: true, dryRun: true })
.then(() => console.log(`Updated!`))
.catch((e) => console.error(e.message)); */
@@ -0,0 +1,65 @@
/**
* Migration template
*/
import dotenv from "dotenv";
import { noCdnClient } from "../sanity/sanity.server";
import { customAlphabet } from "nanoid/non-secure";
dotenv.config();
const token = process.env.SANITY_WRITE_KEY;
/* Key-function used by sanity */
const randKey = () => {
const nanoid = customAlphabet("1234567890abcdef", 12);
return nanoid();
};
const main = async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const transactionClient = noCdnClient(token).transaction();
const docs = await noCdnClient(token).fetch(`*[_type in ["ds_artikkel"]]`);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const newData = [];
docs.forEach((data) => {
data?.slug?.current
? newData.push({
_id: data._id,
kategori: "styling",
slug_v2: {
_type: "slug",
current: data.slug.current.replace(
"designsystem/side/",
"grunnleggende/styling/"
),
},
})
: console.log(data.heading);
});
for (const data of newData) {
const id = data._id;
delete data._id;
transactionClient.patch(id, (p) =>
p
.set({ ...data })
.unset(["metadata_feedback", "isMigrated", "artikkel_type"])
);
}
/* transactionClient.create({
_type: "redirect",
source: `/tema`,
destination: `/god-praksis`,
permanent: true,
});*/
await transactionClient
.commit({ autoGenerateArrayKeys: true, dryRun: true })
.then((a) => console.log(`Updated! \n${JSON.stringify(a, null, 2)}`))
.catch((e) => console.error(e.message));
};
main();
+89 -93
View File
@@ -121,13 +121,6 @@ const spesialSeksjon = `_type == "spesial_seksjon" =>{
slug,
}
},
modul == "farge_kategori" =>{
"farge": farge_ref->{..., description[]{
...,
${markDef}
}
}
},
modul == "token_kategori" =>{
"token": token_ref->{...}
}
@@ -161,16 +154,18 @@ ${defaultBlock},
export const allDocuments = `*[]{...,'slug': slug.current }`;
export const akselTema = `*[_type == "aksel_tema"]{
export const akselTema = `{"temaer": *[_type == "aksel_tema"]{
...,
"refCount": count(*[_type == "aksel_artikkel" && !(_id in path("drafts.**")) && references(^._id)])
}`;
}}`;
export const akselBloggPosts = `*[_type == "aksel_blogg"] | order(_createdAt desc){
...,
"slug": slug.current,
contributors[]->{
title
export const akselBloggPosts = `{
"bloggposts": *[_type == "aksel_blogg"] | order(_createdAt desc){
...,
"slug": slug.current,
contributors[]->{
title
}
}
}`;
@@ -187,50 +182,63 @@ export const akselForsideQuery = `*[_type == "vk_frontpage"][0]{
hovedside->{slug, heading},
undersider[]->{slug, heading}
},
"bloggs": ${akselBloggPosts},
"temaer": ${akselTema}
"bloggs": *[_type == "aksel_blogg"] | order(_createdAt desc){
...,
"slug": slug.current,
contributors[]->{
title
}
},
"temaer": *[_type == "aksel_tema"]{
...,
"refCount": count(*[_type == "aksel_artikkel" && !(_id in path("drafts.**")) && references(^._id)])
}
}`;
export const akselDocumentsByType = `*[_type in $types]{ _type, _id, 'slug': slug.current }`;
export const akselPrinsippBySlug = `*[slug.current == $slug] | order(_updatedAt desc)[0]
{
...,
"slug": slug.current,
"content": select(
$valid == "true" => content[]{
...,
${deRefs}
},
$valid != "true" => []
),
contributors[]->{
title
export const akselPrinsippBySlug = `{
"prinsipp": *[slug.current == $slug] | order(_updatedAt desc)[0]
{
...,
"slug": slug.current,
"content": select(
$valid == "true" => content[]{
...,
${deRefs}
},
$valid != "true" => []
),
contributors[]->{
title
}
}
}`;
export const akselDocumentBySlug = `*[slug.current == $slug] | order(_updatedAt desc)[0]
{
...,
"slug": slug.current,
content[]{
export const akselDocumentBySlug = `{
"page": *[slug.current == $slug] | order(_updatedAt desc)[0]
{
...,
${deRefs}
},
tema[]->{title},
contributors[]->{
title
},
relevante_artikler[]->{
_id,
heading,
_createdAt,
_updatedAt,
publishedAt,
"slug": slug.current,
"tema": tema[]->tag,
ingress,
"contributor": contributors[0]->title,
content[]{
...,
${deRefs}
},
tema[]->{title, slug},
contributors[]->{
title
},
relevante_artikler[]->{
_id,
heading,
_createdAt,
_updatedAt,
publishedAt,
"slug": slug.current,
"tema": tema[]->tag,
ingress,
"contributor": contributors[0]->title,
}
}
}`;
@@ -289,21 +297,10 @@ export const dsSlugQuery = `{
${deRefs}
}
},
bruk_tab[]{
...,
${deRefs}
},
content[]{
...,
${deRefs}
},
content_tabs[]{
...,
content[]{
...,
${deRefs}
}
},
},
${dsNavQuery}
}`;
@@ -321,13 +318,12 @@ export const dsNavigationQuery = `
}
`;
export const akselTemaNames = `*[_type == "aksel_tema" && count(*[references(^._id)]) > 0].title`;
export const akselTemaNames = `*[_type == "aksel_tema" && count(*[references(^._id)]) > 0].slug`;
export const akselTemaDocs = `*[_type == "aksel_tema"]{
...,
"ansvarlig": ansvarlig->{title, roller},
bruk_seksjoner == true => {
"artikler": [],
export const akselTemaDocs = `{
"tema": *[_type == "aksel_tema" && slug.current == $slug] | order(_updatedAt desc)[0]{
...,
"ansvarlig": ansvarlig->{title, roller},
seksjoner[]{
...,
beskrivelse[]{
@@ -346,35 +342,35 @@ export const akselTemaDocs = `*[_type == "aksel_tema"]{
"contributor": contributors[0]->title,
}
}
},
bruk_seksjoner != true => {
"artikler": *[_type=='aksel_artikkel' && references(^._id) && !(_id in path("drafts.**"))] | order(_createdAt desc){
_id,
heading,
_createdAt,
_updatedAt,
publishedAt,
"slug": slug.current,
"tema": tema[]->tag,
ingress,
"contributor": contributors[0]->title,
},
"seksjoner": []
},
}
}`;
export const akselBloggBySlug = `*[slug.current == $slug] | order(_updatedAt desc)[0]
{
...,
"slug": slug.current,
"content": select(
$valid == "true" => content[]{
export const akselBloggBySlug = `{
"blogg": *[slug.current == $slug && _type == "aksel_blogg"] | order(_updatedAt desc)[0]
{
...,
"slug": slug.current,
"content": select(
$valid == "true" => content[]{
...,
${deRefs}
},
$valid != "true" => []
),
contributors[]->{
title
},
}
}`;
export const akselStandaloneBySlug = `{
"page": *[slug.current == $slug && _type == "aksel_standalone"] | order(_updatedAt desc)[0]
{
...,
"slug": slug.current,
content[]{
...,
${deRefs}
},
$valid != "true" => []
),
contributors[]->{
title
},
}
}
}`;
+12 -52
View File
@@ -1,26 +1,14 @@
import imageUrlBuilder from "@sanity/image-url";
import {
createCurrentUserHook,
createPreviewSubscriptionHook,
} from "next-sanity";
import { SanityT } from "..";
import { config } from "./config";
import { akselDocumentsByType, akselTemaNames, dsDocuments } from "./queries";
import { getClient, noCdnClient, sanityClient } from "./sanity.server";
const imageBuilder = imageUrlBuilder(sanityClient);
export const usePreviewSubscription = createPreviewSubscriptionHook(config);
export const useCurrentUser = createCurrentUserHook(config);
export function urlFor(source: any) {
return imageBuilder.image(source);
}
export const getTemaSlug = (s: string) =>
s ? s.toLowerCase().trim().replace(/\s+/g, "-") : null;
export const getAllPages = async (token?: string) => {
const pages = await getDsPaths(token).then((paths) =>
paths.map((slugs) => slugs.join("/"))
@@ -36,7 +24,7 @@ export const getAllPages = async (token?: string) => {
"blogg",
...pages,
...artikler,
...temaer.map((x) => `tema/${x}`),
...temaer.map((x) => `god-praksis/${x}`),
];
};
@@ -54,8 +42,13 @@ export const getAkselDocuments = async (
const documents: any[] | null = await client.fetch(akselDocumentsByType, {
types:
source === "all"
? `["aksel_artikkel", "aksel_blogg", "aksel_prinsipp", "aksel_standalone"]`
: `["${source}"]`,
? [
"aksel_artikkel",
"aksel_blogg",
"aksel_prinsipp",
"aksel_standalone",
]
: [source],
});
const paths = [];
@@ -80,33 +73,7 @@ export const getDsPaths = async (token?: string): Promise<string[][]> => {
return null;
}
const slug = page.slug.split("/");
const defaultPush = () => paths.push(slug);
switch (page._type) {
case "ds_artikkel": {
if (!page?.artikkel_type) {
defaultPush();
break;
}
if (!page.content_tabs) break;
const tabbedArticleTabs = page.content_tabs
.map((tab) => {
return tab.content && tab.title
? tab.title?.toLowerCase().replace(/\s+/g, "-")
: null;
})
.filter((x) => !!x);
tabbedArticleTabs.forEach((tab) => {
paths.push([...slug, tab]);
});
defaultPush();
break;
}
default:
defaultPush();
break;
}
paths.push(slug);
});
return paths;
};
@@ -122,14 +89,7 @@ export const validateDsPath = (
if (slug.length === 2) return true;
switch (doc._type) {
case "ds_artikkel":
return (
isLvl2 &&
doc.content_tabs &&
doc.content_tabs.find(
(x) => x.title?.toLowerCase().replace(/\s+/g, "-") === slug[2]
)
);
/* Støtte gamle url-er */
case "komponent_artikkel":
return slug?.[2] === "kode";
default:
@@ -139,6 +99,6 @@ export const validateDsPath = (
export const getAkselTema = async (token?: string): Promise<string[]> => {
const client = token ? noCdnClient(token) : getClient();
const tags: string[] = await client.fetch(akselTemaNames);
return tags.map(getTemaSlug);
const tags: { current: string }[] = await client.fetch(akselTemaNames);
return tags.map((x) => x?.current);
};
@@ -10,13 +10,7 @@ const docTypes = [
const akselSpesifics = `
_type == "aksel_prinsipp" => {"prinsipp": prinsipp.prinsippvalg},
_type == "aksel_artikkel" => {"tema": tema[]->title}`;
const dsSpesifics = `
artikkel_type == true => {
"tabs": content_tabs[].title
}
`;
_type == "aksel_artikkel" => {"tema": tema[]->slug.current}`;
const query = `
*[_type in $types]{
@@ -25,7 +19,6 @@ const query = `
"url": slug.current,
heading,
${akselSpesifics},
${dsSpesifics}
}`;
export const generateObjects = async () => {
@@ -51,33 +44,10 @@ export const generateObjects = async () => {
objects.push(doc);
break;
case "ds_artikkel":
if (doc.tabs) {
doc.tabs.forEach((x, i) =>
objects.push({
...doc,
tab: x,
url:
i > 0
? `${doc.url}/${x.toLowerCase().replace(/\s+/g, "-")}`
: doc.url,
})
);
break;
}
objects.push(doc);
break;
case "komponent_artikkel":
objects.push({
...doc,
tab: "bruk",
rank: 1,
});
objects.push({
...doc,
tab: "bruk",
url: `${doc.url}/kode`,
rank: 2,
});
objects.push(doc);
break;
default:
break;
@@ -4,7 +4,6 @@ export const mockArtikkel = {
_rev: "p611vx-xfw-51n-25p-djs2hyal8",
_type: "ds_artikkel",
_updatedAt: "2022-05-13T14:00:57Z",
artikkel_type: false,
contributors: [
{ title: "Ola Normann" },
{ title: "Petter Pettersen" },
+130 -312
View File
@@ -97,26 +97,6 @@ eks: Utvikler, Webanalytiker, uu-spesialist
profile_page?: string;
}
/**
* Navigation
*/
interface navigation extends Sanity.Document {
_type: "navigation";
/**
* Tittel - `String`
*/
title?: string;
/**
* Sidemeny - `Array`
Linker eller dropdowns med linker. Maks dybde på 2 dropdowns er støttet. Sider må være publisert før de kan linkes her.
*/
sidemenu?: Array<
Sanity.Keyed<navigation_dropdown> | Sanity.Keyed<navigation_link>
>;
}
/**
* Redirect
*/
@@ -140,79 +120,105 @@ Linker eller dropdowns med linker. Maks dybde på 2 dropdowns er støttet. Sider
}
/**
* Fargekategori
* Navigation
*/
interface ds_color_categories extends Sanity.Document {
_type: "ds_color_categories";
interface ds_navigation extends Sanity.Document {
_type: "ds_navigation";
/**
* Tittel - `String`
* Designsystem navigajsons-struktur - `String`
*/
title?: string;
/**
* Beskrivelse - `RegistryReference`
* Header linker - `Array`
*/
description?: riktekst_enkel;
/**
* Farger - `Array`
*/
colors?: Array<Sanity.Keyed<ds_color>>;
headings?: Array<Sanity.Keyed<ds_navigation_heading>>;
}
/**
* Tokens
* Komponentartikkel
*/
interface ds_tokens extends Sanity.Document {
_type: "ds_tokens";
interface komponent_artikkel extends Sanity.Document {
_type: "komponent_artikkel";
/**
* Navn - `String`
* Publiseringsdato - `Datetime`
Synlig bare for admins. Setter publiseringsdato for dokument
*/
title?: string;
publishedAt?: string;
/**
* Verdi - `String`
* Redaktører - `Array`
Legg til alle som har bidratt med denne siden!
*/
token?: string;
contributors?: Array<Sanity.KeyedReference<editor>>;
/**
* Faktisk verdi - `String`
* Sidetittel - `String`
Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av siden i URL.
*/
raw?: string;
heading?: string;
/**
* Parent - `String`
* url - `Slug`
*/
parent?: string;
slug?: {
_type: "slug";
current: string;
};
/**
* Beskrivelse - `String`
* url (v2) - `Slug`
*/
beskrivelse?: string;
/**
* Autogenerert - `Boolean`
*/
autogenerated?: boolean;
}
/**
* Tokens
*/
interface token_kategori extends Sanity.Document {
_type: "token_kategori";
/**
* Navn - `String`
*/
title?: string;
slug_v2?: {
_type: "slug_v2";
current: string;
};
/**
* Kategori - `String`
*/
kategori?: string;
kategori?: "core" | "internal";
/**
* Metadata - `Object`
*/
status?: {
/**
* Status - `String`
*/
tag?: "beta" | "new" | "ready" | "deprecated";
/**
* Thumbnail/og-bilde - `Image`
*/
bilde?: {
asset: Sanity.Asset;
crop?: Sanity.ImageCrop;
hotspot?: Sanity.ImageHotspot;
};
};
/**
* Intro - `RegistryReference`
*/
intro?: intro_komponent;
/**
* Innhold - `RegistryReference`
*/
content?: riktekst_komponent;
/**
* Kodepakker - `Array`
*/
kodepakker?: Array<Sanity.Keyed<string>>;
/**
* Figma lenke (optional) - `Url`
*/
figma_link?: string;
}
/**
@@ -256,6 +262,23 @@ Linker eller dropdowns med linker. Maks dybde på 2 dropdowns er støttet. Sider
>;
}
/**
* Tokens
*/
interface token_kategori extends Sanity.Document {
_type: "token_kategori";
/**
* Navn - `String`
*/
title?: string;
/**
* Kategori - `String`
*/
kategori?: string;
}
/**
* Autogenerert Propdata
*/
@@ -317,78 +340,6 @@ Linker eller dropdowns med linker. Maks dybde på 2 dropdowns er støttet. Sider
>;
}
/**
* Komponentartikkel-template
*/
interface ds_component_template extends Sanity.Document {
_type: "ds_component_template";
/**
* Publiseringsdato - `Datetime`
Synlig bare for admins. Setter publiseringsdato for dokument
*/
publishedAt?: string;
/**
* Redaktører - `Array`
Legg til alle som har bidratt med denne siden!
*/
contributors?: Array<Sanity.KeyedReference<editor>>;
/**
* Sidetittel - `String`
Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av siden i URL.
*/
heading?: string;
/**
* url - `Slug`
*/
slug?: {
_type: "slug";
current: string;
};
/**
* Metadata - `Object`
*/
status?: {
/**
* Status - `String`
*/
tag?: "beta" | "new" | "ready" | "deprecated";
/**
* Thumbnail/og-bilde - `Image`
*/
bilde?: {
asset: Sanity.Asset;
crop?: Sanity.ImageCrop;
hotspot?: Sanity.ImageHotspot;
};
};
/**
* Intro - `RegistryReference`
*/
intro?: intro_komponent;
/**
* Innhold - `RegistryReference`
*/
bruk_tab?: riktekst_komponent;
/**
* Kodepakker - `Array`
*/
kodepakker?: Array<Sanity.Keyed<string>>;
/**
* Figma lenke (optional) - `Url`
*/
figma_link?: string;
}
/**
* Forside
*/
@@ -441,27 +392,10 @@ Beskriv bildet for skjermlesere
}
/**
* Navigation
* Komponentartikkel-template
*/
interface ds_navigation extends Sanity.Document {
_type: "ds_navigation";
/**
* Designsystem navigajsons-struktur - `String`
*/
title?: string;
/**
* Header linker - `Array`
*/
headings?: Array<Sanity.Keyed<ds_navigation_heading>>;
}
/**
* Komponentartikkel
*/
interface komponent_artikkel extends Sanity.Document {
_type: "komponent_artikkel";
interface ds_component_template extends Sanity.Document {
_type: "ds_component_template";
/**
* Publiseringsdato - `Datetime`
@@ -489,6 +423,19 @@ Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av sid
current: string;
};
/**
* url (v2) - `Slug`
*/
slug_v2?: {
_type: "slug_v2";
current: string;
};
/**
* Kategori - `String`
*/
kategori?: "core" | "internal";
/**
* Metadata - `Object`
*/
@@ -516,7 +463,7 @@ Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av sid
/**
* Innhold - `RegistryReference`
*/
bruk_tab?: riktekst_komponent;
content?: riktekst_komponent;
/**
* Kodepakker - `Array`
@@ -535,11 +482,6 @@ Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av sid
interface ds_artikkel extends Sanity.Document {
_type: "ds_artikkel";
/**
* Migrert riktekst - `Boolean`
*/
isMigrated?: boolean;
/**
* Publiseringsdato - `Datetime`
Synlig bare for admins. Setter publiseringsdato for dokument
@@ -567,51 +509,22 @@ Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av sid
};
/**
* Layout - `String`
'Full' bruker hele bredden, men fjerner table of content (bruk bare for eks ikonside eller komponentvisning)
* url (v2) - `Slug`
*/
layout?: "full" | "default";
slug_v2?: {
_type: "slug_v2";
current: string;
};
/**
* Bruk Tabs - `Boolean`
* Kategori - `String`
*/
artikkel_type?: boolean;
kategori?: "styling" | "tokens" | "staesj" | "guider";
/**
* Innhold - `RegistryReference`
*/
content?: riktekst_ds_artikkel;
/**
* Innhold i Tabs - `Array`
*/
content_tabs?: Array<
Sanity.Keyed<{
_type: "tab";
/**
* Tittel - `String`
Innhold vil da legges under url/tab-tittel
*/
title?: string;
/**
* Innhold - `RegistryReference`
*/
content?: riktekst_ds_artikkel;
}>
>;
/**
* Tilbakemeldinger - `Object`
*/
metadata_feedback?: {
/**
* Skjul artikkel feedback modul - `Boolean`
Gjemmer <<Var denne artikkelen til hjelp?>> modulen.
*/
hide_feedback?: boolean;
};
}
/**
@@ -697,11 +610,6 @@ Anbefalt størrelse er 1200:630px
hotspot?: Sanity.ImageHotspot;
};
};
/**
* Migrert riktekst - `Boolean`
*/
isMigrated?: boolean;
}
/**
@@ -767,11 +675,6 @@ Anbefalt størrelse er 1200:630px
hotspot?: Sanity.ImageHotspot;
};
};
/**
* Migrert riktekst - `Boolean`
*/
isMigrated?: boolean;
}
/**
@@ -796,18 +699,26 @@ Brukes i kort og innganger
*/
beskrivelse?: riktekst_enkel;
/**
* Hidden - `Boolean`
*/
bruk_seksjoner?: boolean;
/**
* Shortname - `Slug`
En mer sanitert visning av tema-navnet i url ene
*/
slug?: {
_type: "slug";
current: string;
};
/**
* Ansvarlig for tema - `Reference`
Legg til redaktør som har forvaltningsansvaret for temaet
*/
ansvarlig?: Sanity.Reference<editor>;
/**
* Bruk seksjonsinndeling - `Boolean`
Vil ikke vise artikler som ikke er lagt til i seksjoner hvis valgt!
*/
bruk_seksjoner?: boolean;
/**
* Seksjonering - `Array`
Del inn artiklene i flere seksjoner (vises ikke i preview før publisering desverre)
@@ -918,11 +829,6 @@ Anbefalt størrelse er 1200:630px
hotspot?: Sanity.ImageHotspot;
};
};
/**
* Migrert riktekst - `Boolean`
*/
isMigrated?: boolean;
}
/**
@@ -955,11 +861,6 @@ Bruk en kort og konsis tittel om mulig. Blir satt som `<H1 />` på toppen av sid
* Innhold - `RegistryReference`
*/
content?: riktekst_aksel;
/**
* Migrert riktekst - `Boolean`
*/
isMigrated?: boolean;
}
type tabell_v2 = {
@@ -1335,17 +1236,7 @@ Legg til en eller flere elementer
/**
* Modul - `String`
*/
modul?:
| "farge_kategori"
| "token_kategori"
| "ikonsok"
| "endringslogg"
| "komponentoversikt";
/**
* Farge kategori - `Reference`
*/
farge_ref?: Sanity.Reference<ds_color_categories>;
modul?: "token_kategori" | "ikonsok" | "komponentoversikt";
/**
* Token kategori - `Reference`
@@ -1453,7 +1344,7 @@ Vis bare et spesfikt eksempel
standalone?: boolean;
/**
* Installasjon-snippet - `Reference`
* Eksempel-navn - `Reference`
*/
dir?: Sanity.Reference<kode_eksempler_fil>;
@@ -1465,76 +1356,6 @@ Vis bare et spesfikt eksempel
type token_ref = Sanity.Reference<token_kategori>;
type navigation_link = {
_type: "navigation_link";
/**
* Tittel - `String`
*/
title?: string;
/**
* Link - `Reference`
*/
link_ref?: Sanity.Reference<komponent_artikkel | ds_artikkel>;
};
type navigation_dropdown = {
_type: "navigation_dropdown";
/**
* Tittel - `String`
*/
title?: string;
/**
* Meny - `Array`
*/
dropdown?: Array<
Sanity.Keyed<navigation_link> | Sanity.Keyed<navigation_dropdown>
>;
};
type ds_color = {
_type: "ds_color";
/**
* Navn - `String`
*/
title?: string;
/**
* CSS variabelnavn - `String`
*/
full_title?: string;
/**
* Fargetype/nivå - `String`
*/
color_type?: "global" | "semantic";
/**
* Brukt fargenavn - `String`
*/
color_name?: string;
/**
* Fargeroller - `Array`
*/
color_roles?: Array<Sanity.Keyed<string>>;
/**
* Brukt farge - `String`
*/
color_value?: string;
/**
* Fargeindeks - `Number`
Brukes for å endre rekkefølgen på listen. Farger med indeks 0 vil være først, større tall sorteres under der igjen
*/
color_index?: number;
};
type ds_navigation_heading = {
_type: "ds_navigation_heading";
@@ -1580,17 +1401,14 @@ Husk å legge denne til i menyen også, hvis ikke blir den bare tilgjengelig via
type Document =
| vk_frontpage
| editor
| navigation
| redirect
| ds_color_categories
| ds_tokens
| token_kategori
| kode_eksempler_fil
| ds_props
| ds_component_template
| ds_frontpage
| ds_navigation
| komponent_artikkel
| kode_eksempler_fil
| token_kategori
| ds_props
| ds_frontpage
| ds_component_template
| ds_artikkel
| aksel_artikkel
| aksel_blogg
+9 -3
View File
@@ -10,11 +10,11 @@ const withBundleAnalyzer = require("@next/bundle-analyzer")({
const ContentSecurityPolicy = `
default-src 'self' 'unsafe-inline';
font-src 'self' https://cdn.nav.no data:;
img-src 'self' cdn.sanity.io data:;
script-src 'self' 'unsafe-eval';
img-src 'self' cdn.sanity.io https://avatars.githubusercontent.com data:;
script-src 'self' https://in2.taskanalytics.com/tm.js 'nonce-4e1aa203a32e' 'unsafe-eval';
style-src 'self' 'unsafe-inline';
report-uri https://sentry.gc.nav.no/api/113/envelope/?sentry_key=d35bd60e413c489ca0f2fd389b4e6e5e&sentry_version=7;
connect-src 'self' cdn.sanity.io *.api.sanity.io https://amplitude.nav.no https://sentry.gc.nav.no https://*.algolia.net https://*.algolianet.com;
connect-src 'self' wss://hnbe3yhs.api.sanity.io cdn.sanity.io *.api.sanity.io https://amplitude.nav.no https://sentry.gc.nav.no https://*.algolia.net https://*.algolianet.com https://in2.taskanalytics.com/03346;
frame-ancestors localhost:3333 'self' localhost:3000 https://verktoykasse.sanity.studio/;
media-src 'self' cdn.sanity.io;
frame-src 'self' https://web.microsoftstream.com localhost:3000;
@@ -111,6 +111,12 @@ const config = () =>
destination: "https://verktoykasse.sanity.studio",
permanent: true,
},
{
source: "/storybook",
destination:
"https://master--5f801fb2aea7820022de2936.chromatic.com/",
permanent: true,
},
{
source: "/prinsipper",
destination: "/",
+15 -2
View File
@@ -26,10 +26,17 @@
"@radix-ui/react-tabs": "1.0.0",
"@sanity/block-content-to-react": "^3.0.0",
"@sanity/client": "^3.3.0",
"@sanity/code-input": "studio-v3",
"@sanity/icons": "2.1.0",
"@sanity/image-url": "1.0.1",
"@sanity/preview-kit": "^1.2.8",
"@sanity/table": "1.0.0",
"@sanity/ui": "^1.0.0",
"@sanity/vision": "3.0.0-rc.3",
"@svgr/webpack": "^5.5.0",
"algoliasearch": "4.12.2",
"amplitude-js": "^8.8.0",
"boring-avatars": "1.7.0",
"classnames": "^2.3.1",
"codesandbox": "^2.2.3",
"color": "4.2.3",
@@ -41,7 +48,7 @@
"jwt-decode": "3.1.2",
"lodash": "^4.17.21",
"next": "^12.2.0",
"next-sanity": "^1.0.0",
"next-sanity": "^3.1.2",
"prettier": "2.7.1",
"prism-react-renderer": "^1.3.0",
"prismjs": "^1.27.0",
@@ -49,7 +56,14 @@
"react-dom": "^18.0.0",
"react-instantsearch-hooks-web": "^6.26.0",
"react-modal": "3.15.1",
"react-snowfall": "1.2.1",
"sanity": "3.0.0-rc.3",
"sanity-plugin-asset-source-unsplash": "^1.0.0",
"sanity-plugin-graph-view": "^2.0.1",
"sanity-plugin-iframe-pane": "^2.1.1",
"sanity-plugin-media": "^2.0.2",
"sitemap": "^7.0.0",
"suspend-react": "0.0.8",
"tailwindcss": "^3.2.0",
"validator": "^13.7.0"
},
@@ -62,7 +76,6 @@
"@testing-library/jest-dom": "^5.16.0",
"@testing-library/react": "^13.3.0",
"@types/jest": "^29.0.0",
"@types/node": "^17.0.35",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"autoprefixer": "^10.4.0",
+20 -12
View File
@@ -1,14 +1,16 @@
import { Provider } from "@navikt/ds-react";
import PreviewBanner from "components/website-modules/PreviewBanner";
import {
AuthProvider,
IdContext,
initAmplitude,
logPageView,
PreviewBanner,
useScrollToHashOnPageLoad,
} from "@/components";
import { Provider } from "@navikt/ds-react";
} from "components/website-modules/utils/amplitude";
import { useScrollToHashOnPageLoad } from "components/website-modules/utils/util";
import Head from "next/head";
import React, { useEffect } from "react";
import { Router } from "next/router";
import Script from "next/script";
import { useEffect } from "react";
import { AuthProvider } from "../components/website-modules/utils/contexts/authprovider";
import { IdContext } from "../components/website-modules/utils/contexts/id-context";
import "../styles/index.css";
function App({
@@ -18,7 +20,7 @@ function App({
}: {
Component: any;
pageProps: any;
router: any;
router: Router;
}): JSX.Element {
useScrollToHashOnPageLoad();
@@ -36,10 +38,6 @@ function App({
};
}, [router.events]);
/* useEffect(() => {
hotjar.initialize(148751, 6);
}, []); */
return (
<>
<Head>
@@ -58,6 +56,16 @@ function App({
/>
<meta property="og:site_name" content="Aksel" key="ogsitename" />
</Head>
{!router.asPath.startsWith("/eksempler") &&
!router.asPath.startsWith("/admin") && (
<>
<Script src="https://in2.taskanalytics.com/tm.js"></Script>
<Script id="task-analytics" nonce="4e1aa203a32e">
{`window.TA = window.TA||function(){(TA.q=TA.q||[]).push(arguments);};
window.TA('start', '03346')`}
</Script>
</>
)}
{pageProps?.preview && <PreviewBanner />}
<Provider>
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff. Show more