Skip to content

Commit

Permalink
feat(Layout): release new Layout component
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Sep 13, 2023
1 parent 98aaf3f commit 848a8f6
Show file tree
Hide file tree
Showing 114 changed files with 583 additions and 1,166 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: 'Layout'
description: 'To make it easier to build application layout and form-views in line with defined design sketches, there are a number of components for layout.'
status: 'beta'
theme: 'sbanken'
showTabs: true
tabs:
- title: Info
key: /info
# - title: Demos
# key: /demos
breadcrumb:
- text: Layout
href: /uilib/components/layout/
---

import LayoutInfo from 'Docs/uilib/components/layout/info'
// import LayoutDemos from 'Docs/uilib/components/layout/demos'

<LayoutInfo />
{/* <LayoutDemos /> */}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ tabs:
- title: Properties
key: '/properties'
breadcrumb:
- text: Forms
href: /uilib/extensions/forms/
- text: Layout
href: /uilib/extensions/forms/Layout/
href: /uilib/components/layout/
- text: ButtonRow
href: /uilib/extensions/forms/Layout/ButtonRow/
href: /uilib/components/layout/ButtonRow/
---

import Info from 'Docs/uilib/extensions/forms/Layout/ButtonRow/info'
import Demos from 'Docs/uilib/extensions/forms/Layout/ButtonRow/demos'
import Info from 'Docs/uilib/components/layout/ButtonRow/info'
import Demos from 'Docs/uilib/components/layout/ButtonRow/demos'

<Info />
<Demos />
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import ComponentBox from '../../../../../shared/tags/ComponentBox'
import { StepsLayout } from '@dnb/eufemia/src/extensions/forms'
import { Button, Layout } from '@dnb/eufemia/src'

export const Default = () => {
return (
<ComponentBox scope={{ StepsLayout }}>
<Layout.ButtonRow>
<StepsLayout.PreviousButton />
<StepsLayout.NextButton />
<Button>Other button</Button>
</Layout.ButtonRow>
</ComponentBox>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ tabs:
- title: Properties
key: '/properties'
breadcrumb:
- text: Forms
href: /uilib/extensions/forms/
- text: Layout
href: /uilib/extensions/forms/Layout/
href: /uilib/components/layout/
- text: Card
href: /uilib/extensions/forms/Layout/Card/
href: /uilib/components/layout/Card/
---

import Info from 'Docs/uilib/extensions/forms/Layout/Card/info'
import Demos from 'Docs/uilib/extensions/forms/Layout/Card/demos'
import Info from 'Docs/uilib/components/layout/Card/info'
import Demos from 'Docs/uilib/components/layout/Card/demos'

<Info />
<Demos />
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { Layout } from '@dnb/eufemia/src/extensions/forms'
import { Layout } from '@dnb/eufemia/src'
import ComponentBox from '../../../../../shared/tags/ComponentBox'

export const Default = () => {
return (
<ComponentBox scope={{ Layout }}>
<ComponentBox>
<Layout.Card>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
cursus pharetra elit in bibendum. Vivamus tincidunt eleifend tellus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ showTabs: true

## Properties

| Property | Type | Description |
| ----------- | ------------------- | --------------------------------------------------------------------------------------------- |
| `stack` | `boolean` | _(optional)_ True to stack the sub components with lines between. |
| `direction` | `string` | _(optional)_ Direction of sub components. Can be: `row` or `column`. |
| `spacing` | `string` or `false` | _(optional)_ How to separate sub components. Can be: `space`, `line` or `false` for no space. |
| `children` | `React.Node` | _(optional)_ Contents. |
| Property | Type | Description |
| ----------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `stack` | `boolean` | _(optional)_ True to stack the sub components with lines between. |
| `direction` | `string` | _(optional)_ Direction of sub components. Can be: `row` or `column`. |
| `spacing` | `string` or `false` | _(optional)_ How to separate sub components. Valid values as lsited in [FlexContainer](/uilib/components/layout/FlexContainer/properties). |
| `children` | `React.Node` | _(optional)_ Contents. |
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ tabs:
- title: Properties
key: '/properties'
breadcrumb:
- text: Forms
href: /uilib/extensions/forms/
- text: Layout
href: /uilib/extensions/forms/Layout/
href: /uilib/components/layout/
- text: Coumn
href: /uilib/extensions/forms/Layout/Coumn/
href: /uilib/components/layout/Coumn/
---

import Info from 'Docs/uilib/extensions/forms/Layout/Column/info'
import Demos from 'Docs/uilib/extensions/forms/Layout/Column/demos'
import Info from 'Docs/uilib/components/layout/Column/info'
import Demos from 'Docs/uilib/components/layout/Column/demos'

<Info />
<Demos />
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { Layout } from '@dnb/eufemia/src/extensions/forms'
import { Layout } from '@dnb/eufemia/src'
import ComponentBox from '../../../../../shared/tags/ComponentBox'

export const Default = () => {
return (
<ComponentBox scope={{ Layout }}>
<ComponentBox>
<Layout.Column>
<Layout.Card>Card contents</Layout.Card>
<Layout.Card>Card contents</Layout.Card>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
showTabs: true
---

## Properties

Column inherits the properties of [FlexContainer](/uilib/components/layout/FlexContainer/properties) with `direction` already set.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ tabs:
- title: Properties
key: '/properties'
breadcrumb:
- text: Forms
href: /uilib/extensions/forms/
- text: Layout
href: /uilib/extensions/forms/Layout/
href: /uilib/components/layout/
- text: FieldContainer
href: /uilib/extensions/forms/Layout/FieldContainer/
href: /uilib/components/layout/FieldContainer/
---

import Info from 'Docs/uilib/extensions/forms/Layout/FlexContainer/info'
import Demos from 'Docs/uilib/extensions/forms/Layout/FlexContainer/demos'
import Info from 'Docs/uilib/components/layout/FlexContainer/info'
import Demos from 'Docs/uilib/components/layout/FlexContainer/demos'

<Info />
<Demos />
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { P } from '@dnb/eufemia/src'
import {
Layout,
TestElement,
Field,
} from '@dnb/eufemia/src/extensions/forms'
import ComponentBox from '../../../../../shared/tags/ComponentBox'
import { Layout, P } from '@dnb/eufemia/src'
import { TestElement, Field } from '@dnb/eufemia/src/extensions/forms'

export const Default = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.Card>
<Layout.FlexContainer>
<Layout.FlexItem>
Expand All @@ -31,7 +27,7 @@ export const Default = () => {

export const Widths = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.Card>
<P>No width (default)</P>
<Layout.FlexContainer>
Expand All @@ -56,7 +52,7 @@ export const Widths = () => {

export const RowWithFlexItem = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="row">
<Layout.FlexItem>
<TestElement>FlexItem</TestElement>
Expand All @@ -77,7 +73,7 @@ export const RowWithFlexItem = () => {

export const RowWithFlexItemJustifyCenter = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="row" justify="center">
<Layout.FlexItem>
<TestElement>FlexItem</TestElement>
Expand All @@ -98,7 +94,7 @@ export const RowWithFlexItemJustifyCenter = () => {

export const RowWithFlexItemJustifyFlexEnd = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="row" justify="flex-end">
<Layout.FlexItem>
<TestElement>FlexItem</TestElement>
Expand All @@ -119,7 +115,7 @@ export const RowWithFlexItemJustifyFlexEnd = () => {

export const RowWithCard = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="row">
<Layout.Card>FlexItem</Layout.Card>
<Layout.Card>FlexItem</Layout.Card>
Expand All @@ -132,7 +128,7 @@ export const RowWithCard = () => {

export const RowWithFieldString = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="row">
<Field.String label="Label" value="Foo" />
<Field.String label="Label" value="Foo" />
Expand All @@ -145,7 +141,7 @@ export const RowWithFieldString = () => {

export const ColumnWithFlexItem = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="column">
<Layout.FlexItem>
<TestElement>FlexItem</TestElement>
Expand All @@ -166,7 +162,7 @@ export const ColumnWithFlexItem = () => {

export const ColumnWithCard = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexContainer direction="column">
<Layout.Card>Card contents</Layout.Card>
<Layout.Card>Card contents</Layout.Card>
Expand All @@ -179,7 +175,7 @@ export const ColumnWithCard = () => {

export const ColumnWithFieldString = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.Card>
<Layout.FlexContainer direction="column">
<Field.String label="Label" value="Foo" />
Expand All @@ -194,7 +190,7 @@ export const ColumnWithFieldString = () => {

export const ColumnSpaceDivider = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.Card>
<Layout.FlexContainer direction="column" divider="space">
<Field.String label="Label" value="Value" />
Expand All @@ -209,7 +205,7 @@ export const ColumnSpaceDivider = () => {

export const ColumnLineDivider = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.Card>
<Layout.FlexContainer direction="column" divider="line">
<Field.String label="Label" value="Value" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
showTabs: true
---

## Properties

| Property | Type | Description |
| ----------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `className` | `string` | _(optional)_ Outer DOM element class name |
| `direction` | `string` | _(optional)_ Direction of sub components. Can be: `row` or `column`. |
| `wrap` | `boolean` | _(optional)_ True to wrap contents if there is not enough space. |
| `justify` | `string` | _(optional)_ How to place sub components if there is space available in the container. Can be: `flex-start`, `flex-end`, `center`, `space-between`, `space-around` or `space-evenly`. |
| `divider` | `string` | _(optional)_ How to separate sub components. Can be: `space` or `line`. |
| `spacing` | `string` or `false` | _(optional)_ How much space between sub components. Can be `medium`, `small` or `false` for no spacing. |
| `width` | `string` or `false` | _(optional)_ `small`, `medium` or `large` for predefined standard widths. |
| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `div`. |
| `children` | `React.Node` | _(optional)_ Contents. |
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ tabs:
- title: Properties
key: '/properties'
breadcrumb:
- text: Forms
href: /uilib/extensions/forms/
- text: Layout
href: /uilib/extensions/forms/Layout/
href: /uilib/components/layout/
- text: FlexItem
href: /uilib/extensions/forms/Layout/FlexItem/
href: /uilib/components/layout/FlexItem/
---

import Info from 'Docs/uilib/extensions/forms/Layout/FlexItem/info'
import Demos from 'Docs/uilib/extensions/forms/Layout/FlexItem/demos'
import Info from 'Docs/uilib/components/layout/FlexItem/info'
import Demos from 'Docs/uilib/components/layout/FlexItem/demos'

<Info />
<Demos />
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import ComponentBox from '../../../../../../shared/tags/ComponentBox'
import { P } from '@dnb/eufemia/src'
import {
Layout,
TestElement,
Field,
} from '@dnb/eufemia/src/extensions/forms'
import ComponentBox from '../../../../../shared/tags/ComponentBox'
import { Layout, P } from '@dnb/eufemia/src'
import { TestElement, Field } from '@dnb/eufemia/src/extensions/forms'

export const Default = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.FlexItem>Contents</Layout.FlexItem>
</ComponentBox>
)
}

export const Widths = () => {
return (
<ComponentBox scope={{ Layout, TestElement, Field }}>
<ComponentBox scope={{ TestElement, Field }}>
<Layout.Card>
<P>No width (default)</P>
<Layout.FlexItem>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
showTabs: true
---

## Properties

| Property | Type | Description |
| ----------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `className` | `string` | _(optional)_ Outer DOM element class name |
| `grow` | `boolean` | _(optional)_ True to expand in width/height when there is more space available. |
| `shrink` | `boolean` | _(optional)_ True to shrink in width/height when there is not enough space available for all components within the container. |
| `width` | `string` or `false` | _(optional)_ `small`, `medium` or `large` for predefined standard widths. |
| `element` | `string` or `React.Element` | _(optional)_ Define the type of element. Defaults to `div`. |
| `children` | `React.Node` | _(optional)_ Contents. |
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { useStaticQuery, graphql } from 'gatsby'
import ListSummaryFromEdges from '../../../../../shared/parts/ListSummaryFromEdges'
import ListSummaryFromEdges from '../../../../shared/parts/ListSummaryFromEdges'

export default function ListLayoutComponents() {
const {
Expand All @@ -11,9 +11,7 @@ export default function ListLayoutComponents() {
filter: {
frontmatter: { title: { ne: null }, draft: { ne: true } }
internal: {
contentFilePath: {
glob: "**/uilib/extensions/forms/Layout/**/*"
}
contentFilePath: { glob: "**/uilib/components/layout/*" }
}
}
sort: [{ frontmatter: { title: ASC } }]
Expand Down
Loading

0 comments on commit 848a8f6

Please sign in to comment.