diff --git a/@navikt/core/react/src/index.ts b/@navikt/core/react/src/index.ts index 8713a12bfa..504c3ca9f5 100644 --- a/@navikt/core/react/src/index.ts +++ b/@navikt/core/react/src/index.ts @@ -32,6 +32,7 @@ export * from "./toggle-group"; export * from "./tooltip"; export * from "./typography"; export * from "./util"; +export * from "./layout/bleed"; export * from "./layout/box"; export * from "./layout/stack"; export * from "./layout/grid"; diff --git a/@navikt/core/react/src/layout/bleed/Bleed.stories.tsx b/@navikt/core/react/src/layout/bleed/Bleed.stories.tsx index 6f768ea5d3..4729925801 100644 --- a/@navikt/core/react/src/layout/bleed/Bleed.stories.tsx +++ b/@navikt/core/react/src/layout/bleed/Bleed.stories.tsx @@ -9,33 +9,18 @@ export default { component: Bleed, } satisfies Meta; -const style = ( - -); - export const Default = { render: () => ( <> - {style} - + marginInline="10 0" @@ -44,7 +29,11 @@ export const Default = { - + marginInline="0 10" @@ -53,7 +42,11 @@ export const Default = { - + marginBlock="10 0" @@ -62,10 +55,12 @@ export const Default = { - - - marginBlock="0 10" - + + marginBlock="0 10" @@ -78,12 +73,11 @@ export const Default = { export const AsChild = { render: () => ( <> - {style} - + marginInline="10 0" @@ -92,7 +86,7 @@ export const AsChild = { - + marginInline="0 10" @@ -101,7 +95,7 @@ export const AsChild = { - + marginBlock="10 0" @@ -110,10 +104,8 @@ export const AsChild = { - - - marginBlock="0 10" - + + marginBlock="0 10" @@ -126,7 +118,6 @@ export const AsChild = { export const Breakpoints = { render: () => ( <> - {style} - + {'marginInline={{ xs: "10 0", md: "20 0" }}'} @@ -148,7 +139,7 @@ export const Breakpoints = { padding={{ xs: "5", md: "10" }} > - + {'marginInline={{ xs: "0 10", md: "0 20" }}'} @@ -162,7 +153,7 @@ export const Breakpoints = { padding={{ xs: "5", md: "10" }} > - + {'marginBlock={{ xs: "10 0", md: "20 0" }}'} @@ -176,12 +167,10 @@ export const Breakpoints = { padding={{ xs: "5", md: "10" }} > - - - - {'marginBlock={{ xs: "0 10", md: "0 20" }}'} - - + + + {'marginBlock={{ xs: "0 10", md: "0 20" }}'} + @@ -193,15 +182,40 @@ export const Breakpoints = { export const Px = { render: () => ( - - - - - marginInline="px 0" + <> + + + + + L + + + L - + - + ), }; @@ -216,9 +230,6 @@ export const Full = { .maxWidth { max-width: 300px; } - .flex { - display: flex; - } `} @@ -271,36 +282,32 @@ export const ReflectivePadding = { <> -

- Note: reflectivePadding Only really works
well when asChild is - implemented -

CSS string

- + before Bleed - + without reflectivePadding - + with reflectivePadding @@ -317,7 +324,7 @@ export const ReflectivePadding = { background="surface-alt-2-subtle" padding={{ xs: "2", sm: "4", md: "6", lg: "8", xl: "10" }} > - + before Bleed @@ -332,12 +339,13 @@ export const ReflectivePadding = { > without reflectivePadding @@ -353,13 +361,14 @@ export const ReflectivePadding = { > with reflectivePadding diff --git a/@navikt/core/react/src/layout/bleed/Bleed.tsx b/@navikt/core/react/src/layout/bleed/Bleed.tsx index d83f2ccd99..c672ec2980 100644 --- a/@navikt/core/react/src/layout/bleed/Bleed.tsx +++ b/@navikt/core/react/src/layout/bleed/Bleed.tsx @@ -53,7 +53,7 @@ export interface BleedProps extends React.HTMLAttributes { * * @example * - * + * * Some content * * diff --git a/aksel.nav.no/website/pages/eksempler/primitive-bleed/as-child.tsx b/aksel.nav.no/website/pages/eksempler/primitive-bleed/as-child.tsx new file mode 100644 index 0000000000..40091cf835 --- /dev/null +++ b/aksel.nav.no/website/pages/eksempler/primitive-bleed/as-child.tsx @@ -0,0 +1,60 @@ +import { Bleed, BodyLong, Box, VStack } from "@navikt/ds-react"; +import { withDsExample } from "components/website-modules/examples/withDsExample"; + +const Example = () => { + return ( + <> + + + + + + marginInline="10 0" + + + + + + + + + marginInline="0 10" + + + + + + + + + marginBlock="10 0" + + + + + + + + + marginBlock="0 10" + + + + + + + ); +}; + +export default withDsExample(Example, { + showBreakpoints: true, +}); + +/* Storybook story */ +export const Demo = { + render: Example, +}; + +export const args = { + index: 0, +}; diff --git a/aksel.nav.no/website/pages/eksempler/primitive-bleed/breakpoints.tsx b/aksel.nav.no/website/pages/eksempler/primitive-bleed/breakpoints.tsx new file mode 100644 index 0000000000..43951bb5b7 --- /dev/null +++ b/aksel.nav.no/website/pages/eksempler/primitive-bleed/breakpoints.tsx @@ -0,0 +1,92 @@ +import { Bleed, BodyLong, Box, VStack } from "@navikt/ds-react"; +import { withDsExample } from "components/website-modules/examples/withDsExample"; + +const Example = () => { + return ( + <> + + + + + + + {'marginInline={{ xs: "10 0", md: "20 0" }}'} + + + + + + + + + + + {'marginInline={{ xs: "0 10", md: "0 20" }}'} + + + + + + + + + + + {'marginBlock={{ xs: "10 0", md: "20 0" }}'} + + + + + + + + + + + {'marginBlock={{ xs: "0 10", md: "0 20" }}'} + + + + + + + + ); +}; + +export default withDsExample(Example, { + showBreakpoints: true, +}); + +/* Storybook story */ +export const Demo = { + render: Example, +}; + +export const args = { + index: 0, +}; diff --git a/aksel.nav.no/website/pages/eksempler/primitive-bleed/default.tsx b/aksel.nav.no/website/pages/eksempler/primitive-bleed/default.tsx new file mode 100644 index 0000000000..0bd96f1787 --- /dev/null +++ b/aksel.nav.no/website/pages/eksempler/primitive-bleed/default.tsx @@ -0,0 +1,58 @@ +import { Bleed, BodyLong, Box, VStack } from "@navikt/ds-react"; +import { withDsExample } from "components/website-modules/examples/withDsExample"; + +const Example = () => { + return ( + + + + + + marginInline="10 0" + + + + + + + + + marginInline="0 10" + + + + + + + + + marginBlock="10 0" + + + + + + + + + marginBlock="0 10" + + + + + + ); +}; + +export default withDsExample(Example, { + showBreakpoints: true, +}); + +/* Storybook story */ +export const Demo = { + render: Example, +}; + +export const args = { + index: 0, +}; diff --git a/aksel.nav.no/website/pages/eksempler/primitive-bleed/full.tsx b/aksel.nav.no/website/pages/eksempler/primitive-bleed/full.tsx new file mode 100644 index 0000000000..587537eec8 --- /dev/null +++ b/aksel.nav.no/website/pages/eksempler/primitive-bleed/full.tsx @@ -0,0 +1,51 @@ +import { Bleed, BodyLong, Box, VStack } from "@navikt/ds-react"; +import { withDsExample } from "components/website-modules/examples/withDsExample"; + +const Example = () => { + return ( + <> + + + + + + marginInline="full" + + + + + + + + + marginInline="full 0" + + + + + + + + + marginInline="0 full" + + + + + + + ); +}; + +export default withDsExample(Example, { + showBreakpoints: true, +}); + +/* Storybook story */ +export const Demo = { + render: Example, +}; + +export const args = { + index: 0, +}; diff --git a/aksel.nav.no/website/pages/eksempler/primitive-bleed/px.tsx b/aksel.nav.no/website/pages/eksempler/primitive-bleed/px.tsx new file mode 100644 index 0000000000..85e5df2048 --- /dev/null +++ b/aksel.nav.no/website/pages/eksempler/primitive-bleed/px.tsx @@ -0,0 +1,54 @@ +import { Bleed, Box, HStack } from "@navikt/ds-react"; +import { withDsExample } from "components/website-modules/examples/withDsExample"; + +const Example = () => { + return ( + <> + + + + + L + + + L + + + + + ); +}; + +export default withDsExample(Example, { + showBreakpoints: true, +}); + +/* Storybook story */ +export const Demo = { + render: Example, +}; + +export const args = { + index: 0, +}; diff --git a/aksel.nav.no/website/pages/eksempler/primitive-bleed/reflective-padding.tsx b/aksel.nav.no/website/pages/eksempler/primitive-bleed/reflective-padding.tsx new file mode 100644 index 0000000000..f51734e6ba --- /dev/null +++ b/aksel.nav.no/website/pages/eksempler/primitive-bleed/reflective-padding.tsx @@ -0,0 +1,118 @@ +import { Bleed, BodyLong, Box, HStack, VStack } from "@navikt/ds-react"; +import { withDsExample } from "components/website-modules/examples/withDsExample"; + +const Example = () => { + return ( + <> + + + +

CSS string

+ + + + before Bleed + + + + + + + without reflectivePadding + + + + + + + with reflectivePadding + + + +
+ + +

breakpoints

+ + + + before Bleed + + + + + + + without reflectivePadding + + + + + + + with reflectivePadding + + + +
+
+ + ); +}; + +export default withDsExample(Example, { + showBreakpoints: true, +}); + +/* Storybook story */ +export const Demo = { + render: Example, +}; + +export const args = { + index: 0, +};