Compare commits

..
Author SHA1 Message Date
github-actions[bot]andgithub-actions[bot] be4a951962 Version Packages (#1866)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-03-17 14:53:51 +01:00
Ken 1276b4d7ef 🐛 ExpansionCard hadde feil default-title size 2023-03-17 14:49:50 +01:00
Ken 8880b0dfb5 🎨 Expansioncard-modul 2023-03-17 14:37:15 +01:00
30 changed files with 182 additions and 31 deletions

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
# @navikt/aksel-icons
## 2.8.1
## 2.8.0
## 2.7.8
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/aksel-icons",
"version": "2.8.0",
"version": "2.8.1",
"author": "Aksel | NAV",
"homepage": "https://aksel.nav.no/ikoner",
"repository": {
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-codemod
## 2.8.1
## 2.8.0
## 2.7.8
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-codemod",
"version": "2.8.0",
"version": "2.8.1",
"description": "Aksel codemods for NAVs designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
+2 -2
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.8.0",
"@navikt/ds-react": "^2.8.0",
"@navikt/ds-icons": "^2.8.1",
"@navikt/ds-react": "^2.8.1",
"clsx": "^1.1.1"
},
"devDependencies": {
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-css
## 2.8.1
## 2.8.0
### Minor Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css",
"version": "2.8.0",
"version": "2.8.1",
"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.8.0",
"@navikt/ds-tokens": "^2.8.1",
"normalize.css": "^8.0.1",
"postcss": "^8.4.0",
"postcss-cli": "^9.0.0",
+10
View File
@@ -1,5 +1,15 @@
# @navikt/ds-react
## 2.8.1
### Patch Changes
- [`1276b4d7e`](https://github.com/navikt/aksel/commit/1276b4d7efd831d20345292dbb21a11d100a0ddd) Thanks [@KenAJoh](https://github.com/KenAJoh)! - :bug: Endret default title-size til medium for ExpansionCard
- Updated dependencies []:
- @navikt/aksel-icons@2.8.1
- @navikt/ds-icons@2.8.1
## 2.8.0
### Minor Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react",
"version": "2.8.0",
"version": "2.8.1",
"description": "Aksel react-components for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -37,8 +37,8 @@
},
"dependencies": {
"@floating-ui/react": "0.17.0",
"@navikt/aksel-icons": "^2.8.0",
"@navikt/ds-icons": "^2.8.0",
"@navikt/aksel-icons": "^2.8.1",
"@navikt/ds-icons": "^2.8.1",
"@radix-ui/react-tabs": "1.0.0",
"@radix-ui/react-toggle-group": "1.0.0",
"clsx": "^1.2.1",
@@ -7,7 +7,7 @@ interface ExpansionCardTitleProps
children: React.ReactNode;
/**
* Changes text-sizing
* @default small
* @default medium
*/
size?: "large" | "medium" | "small";
}
@@ -18,7 +18,7 @@ export type ExpansionCardTitleType = OverridableComponent<
>;
export const ExpansionCardTitle: ExpansionCardTitleType = forwardRef(
({ className, as: Component = "h3", size = "small", ...rest }, ref) => (
({ className, as: Component = "h3", size = "medium", ...rest }, ref) => (
<Component
{...rest}
ref={ref}
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-tailwind
## 2.8.1
## 2.8.0
## 2.7.8
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tailwind",
"version": "2.8.0",
"version": "2.8.1",
"description": "Tailwind config based on @navikt/ds-tokens",
"author": "Aksel | NAV designsystem team",
"keywords": [
@@ -22,7 +22,7 @@
"directory": "@navikt/core/tailwind"
},
"devDependencies": {
"@navikt/ds-tokens": "^2.8.0",
"@navikt/ds-tokens": "^2.8.1",
"@types/jest": "^29.0.0",
"color": "4.2.3",
"jest": "^29.0.0",
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-tokens
## 2.8.1
## 2.8.0
## 2.7.8
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-tokens",
"version": "2.8.0",
"version": "2.8.1",
"description": "Design-tokens for NAV designsystem",
"author": "Aksel | NAV designsystem team",
"keywords": [
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-icons
## 2.8.1
## 2.8.0
## 2.7.8
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-icons",
"version": "2.8.0",
"version": "2.8.1",
"description": "Aksel icons for NAV",
"author": "Aksel | NAV designsystem team",
"repository": {
+2
View File
@@ -1,5 +1,7 @@
# @navikt/ds-css-internal
## 2.8.1
## 2.8.0
## 2.7.8
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-css-internal",
"version": "2.8.0",
"version": "2.8.1",
"description": "CSS for NAV internal Designsystem-components",
"author": "Aksel | NAV designsystem team",
"keywords": [
+8
View File
@@ -1,5 +1,13 @@
# @navikt/ds-react-internal
## 2.8.1
### Patch Changes
- Updated dependencies [[`1276b4d7e`](https://github.com/navikt/aksel/commit/1276b4d7efd831d20345292dbb21a11d100a0ddd)]:
- @navikt/ds-react@2.8.1
- @navikt/ds-icons@2.8.1
## 2.8.0
### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@navikt/ds-react-internal",
"version": "2.8.0",
"version": "2.8.1",
"description": "Aksel react components for internal UIs in NAV",
"author": "Aksel | NAV designsystem team",
"license": "MIT",
@@ -35,8 +35,8 @@
"watch": "tsc --watch -p tsconfig.esm.json"
},
"dependencies": {
"@navikt/ds-icons": "^2.8.0",
"@navikt/ds-react": "^2.8.0",
"@navikt/ds-icons": "^2.8.1",
"@navikt/ds-react": "^2.8.1",
"clsx": "^1.1.1",
"copy-to-clipboard": "^3.3.1"
},
+9 -9
View File
@@ -15,15 +15,15 @@
"website"
],
"dependencies": {
"@navikt/aksel-icons": "^2.8.0",
"@navikt/ds-codemod": "^2.8.0",
"@navikt/ds-css": "^2.8.0",
"@navikt/ds-css-internal": "^2.8.0",
"@navikt/ds-icons": "^2.8.0",
"@navikt/ds-react": "^2.8.0",
"@navikt/ds-react-internal": "^2.8.0",
"@navikt/ds-tailwind": "^2.8.0",
"@navikt/ds-tokens": "^2.8.0"
"@navikt/aksel-icons": "^2.8.1",
"@navikt/ds-codemod": "^2.8.1",
"@navikt/ds-css": "^2.8.1",
"@navikt/ds-css-internal": "^2.8.1",
"@navikt/ds-icons": "^2.8.1",
"@navikt/ds-react": "^2.8.1",
"@navikt/ds-react-internal": "^2.8.1",
"@navikt/ds-tailwind": "^2.8.1",
"@navikt/ds-tokens": "^2.8.1"
},
"devDependencies": {
"prettier-plugin-tailwindcss": "^0.2.3"
@@ -3,6 +3,7 @@ import { BodyLong, Detail, Heading, Ingress, Link } from "@navikt/ds-react";
import BlockContent from "@sanity/block-content-to-react";
import cl from "clsx";
import InnholdsKort from "components/sanity-modules/cards/InnholdsKort";
import ExpansionCard from "components/sanity-modules/ExpansionCard";
import NextLink from "next/link";
import React, { createContext, useContext } from "react";
import {
@@ -49,6 +50,7 @@ const serializers = {
do_dont: ({ node }) => <DoDont node={node} />,
bilde: ({ node }) => <Bilde node={node} />,
alert: ({ node }) => <Alert node={node} />,
expansioncard: ({ node }) => <ExpansionCard node={node} />,
kode: ({ node }) => <Kode node={node} />,
tabell_v2: ({ node }) => <Tabell node={node} />,
accordion: ({ node }) => <Accordion node={node} />,
@@ -0,0 +1,41 @@
import { SanityBlockContent } from "@/sanity-block";
import { ExpansionCard as DsExpansionCard } from "@navikt/ds-react";
import { withErrorBoundary } from "@/error-boundary";
const ExpansionCard = ({
node,
}: {
node: {
heading: string;
heading_level: "h3" | "h4";
description?: string;
body: any[];
};
}): JSX.Element => {
if (!node.heading || !node.body || !node.heading_level) {
return null;
}
return (
<DsExpansionCard className="mb-7 max-w-2xl" aria-label={node.heading}>
<DsExpansionCard.Header>
<DsExpansionCard.Title
as={node.heading_level}
size={node.heading_level === "h3" ? "medium" : "small"}
>
{node.heading}
</DsExpansionCard.Title>
{node?.description && (
<DsExpansionCard.Description>
{node.description}
</DsExpansionCard.Description>
)}
</DsExpansionCard.Header>
<DsExpansionCard.Content>
<SanityBlockContent blocks={node.body} noLastMargin />
</DsExpansionCard.Content>
</DsExpansionCard>
);
};
export default withErrorBoundary(ExpansionCard, "ExpansionCard");
@@ -90,6 +90,13 @@ const defaultBlock = `
${markDef}
}
},
_type == "expansioncard" =>{
...,
body[]{
...,
${markDef}
}
},
_type == "kode" =>{
...,
"ref": ref->{...},
@@ -52,6 +52,7 @@ export const schema: SchemaPluginOptions = {
object.Video,
object.Accordion,
object.Alert,
object.ExpansionCard,
object.Tips,
object.UnikSidemodul,
@@ -9,6 +9,7 @@ export * from "./shared/accordion";
export * from "./shared/alert";
export * from "./shared/bilde";
export * from "./shared/dodont";
export * from "./shared/expansion-card";
export * from "./shared/kode";
export * from "./shared/relatert-innhold";
export * from "./shared/riktekst";
@@ -6,6 +6,8 @@ import { defineField, defineType } from "sanity";
export const Accordion = defineType({
name: "accordion",
title: "Accordion",
description:
"Accordion brukes hvis man har flere seksjoner man ønsker å skjule. Bruke ExpansionCard om du bare skal vise en seksjon",
type: "object",
icon: StackCompactIcon,
fields: [
@@ -37,7 +39,11 @@ export const Accordion = defineType({
},
],
validation: (Rule) =>
Rule.required().min(1).error("Accordion modul må ha minst 1 element"),
Rule.required()
.min(2)
.error(
"Accordion modul må ha minst 2 elementer. Bruk ExpansionCard om du bare trenger 1"
),
}),
],
components: {
@@ -0,0 +1,60 @@
import { ChevronDownIcon } from "@navikt/aksel-icons";
import { defineField, defineType } from "sanity";
export const ExpansionCard = defineType({
name: "expansioncard",
title: "ExpansionCard",
description:
"ExpansionCard brukes hvis man har en seksjon man ønsker å skjule. Bruke Accordion om du trenger flere seksjoner etter hverandre",
type: "object",
icon: ChevronDownIcon,
fields: [
defineField({
title: "Heading",
name: "heading",
type: "string",
validation: (Rule) =>
Rule.required().error("ExpansionCard må ha en heading"),
}),
defineField({
title: "Heading nivå",
name: "heading_level",
description: "ExpansionCard kan ikke brukes som h2",
type: "string",
validation: (Rule) => Rule.required(),
options: {
list: [
{ value: "h3", title: "H3" },
{ value: "h4", title: "H4" },
],
layout: "radio",
},
initialValue: "h3",
}),
defineField({
title: "Description (valgfritt)",
name: "description",
type: "string",
}),
defineField({
title: "Innhold",
name: "body",
type: "riktekst_enkel",
validation: (Rule) =>
Rule.required().error("ExpansionCard må ha innhold"),
}),
],
preview: {
select: {
body: "body",
heading: "heading",
},
prepare(selection) {
return {
title: selection?.heading,
subtitle: `ExpansionCard`,
media: ChevronDownIcon,
};
},
},
});
@@ -133,6 +133,7 @@ const Riktekst = (
"do_dont",
"alert",
"accordion",
"expansioncard",
"tabell_v2",
"video",
];
+2 -2
View File
@@ -10,8 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
"@navikt/ds-css": "2.8.0",
"@navikt/ds-react": "2.8.0",
"@navikt/ds-css": "2.8.1",
"@navikt/ds-react": "2.8.1",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},