-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Grid): move Grid from layout to components (#2750)
This PR is based on #2748 - E.g. `Layout.GridContainer` => `Grid.Container` etc. - Use `chore` as it is already a part of the change-log. --------- Co-authored-by: Anders <anderslangseth@gmail.com>
- Loading branch information
1 parent
def1ad1
commit 85cbe8c
Showing
51 changed files
with
437 additions
and
378 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
packages/dnb-design-system-portal/src/docs/uilib/components/grid.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
title: 'Grid' | ||
description: 'To make it easier to build responsive application layouts in line with defined design sketches, there are a number of components for layout.' | ||
status: 'new' | ||
theme: 'sbanken' | ||
showTabs: true | ||
tabs: | ||
- title: Info | ||
key: /info | ||
- title: Demos | ||
key: /demos | ||
--- | ||
|
||
import Info from 'Docs/uilib/components/grid/info' | ||
import Demos from 'Docs/uilib/components/grid/demos' | ||
|
||
<Info /> | ||
<Demos /> |
67 changes: 67 additions & 0 deletions
67
packages/dnb-design-system-portal/src/docs/uilib/components/grid/Examples.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import React from 'react' | ||
import ComponentBox from '../../../../shared/tags/ComponentBox' | ||
import { Grid } from '@dnb/eufemia/src' | ||
import { TestElement } from '@dnb/eufemia/src/extensions/forms' | ||
|
||
export const colors = [ | ||
{ background: '#babeee' } as React.CSSProperties, | ||
{ background: '#dfe0ee' } as React.CSSProperties, | ||
{ background: '#90d2c3' } as React.CSSProperties, | ||
{ background: '#ecf4be' } as React.CSSProperties, | ||
] | ||
|
||
export const ResponsiveGridContainer = () => { | ||
return ( | ||
<ComponentBox scope={{ TestElement, colors }}> | ||
<Grid.Container rowGap columnGap> | ||
<Grid.Item | ||
span={{ | ||
small: [1, 2], | ||
medium: [1, 3], | ||
large: [1, 12], | ||
}} | ||
style={colors[0]} | ||
element={TestElement} | ||
> | ||
Item A | ||
</Grid.Item> | ||
|
||
<Grid.Item | ||
span={{ | ||
small: [3, 4], | ||
medium: [4, 6], | ||
large: [1, 4], | ||
}} | ||
style={colors[1]} | ||
element={TestElement} | ||
> | ||
Item B | ||
</Grid.Item> | ||
|
||
<Grid.Item | ||
span={{ | ||
small: [2, 3], | ||
medium: [4, 6], | ||
large: [5, 8], | ||
}} | ||
style={colors[2]} | ||
element={TestElement} | ||
> | ||
Item C | ||
</Grid.Item> | ||
|
||
<Grid.Item | ||
span={{ | ||
small: [1, 4], | ||
medium: [4, 6], | ||
large: [9, 12], | ||
}} | ||
style={colors[3]} | ||
element={TestElement} | ||
> | ||
Item D | ||
</Grid.Item> | ||
</Grid.Container> | ||
</ComponentBox> | ||
) | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/dnb-design-system-portal/src/docs/uilib/components/grid/container.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 'Grid.Container' | ||
description: '`Grid.Container` is a building block for CSS Grid based layout of contents and components.' | ||
hideInMenu: true | ||
showTabs: true | ||
tabs: | ||
- title: Info | ||
key: '/info' | ||
- title: Demos | ||
key: '/demos' | ||
- title: Properties | ||
key: '/properties' | ||
breadcrumb: | ||
- text: Grid | ||
href: /uilib/components/grid/ | ||
- text: Container | ||
href: /uilib/components/grid/container/ | ||
--- | ||
|
||
import Info from 'Docs/uilib/components/grid/container/info' | ||
import Demos from 'Docs/uilib/components/grid/container/demos' | ||
|
||
<Info /> | ||
<Demos /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
...ages/dnb-design-system-portal/src/docs/uilib/components/grid/container/info.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
showTabs: true | ||
--- | ||
|
||
import * as Examples from '../item/Examples' | ||
|
||
## Description | ||
|
||
`Grid.Container` is a building block for [CSS grid](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout) based layouts. | ||
|
||
Use [Grid.Item](/uilib/components/grid/item) for you inner wrappers so you can apply a `span` to them. | ||
|
||
```jsx | ||
import { Grid } from '@dnb/eufemia' | ||
|
||
render( | ||
<Grid.Container> | ||
<Grid.Item span={[1, 6]}>Item A</Grid.Item> | ||
<Grid.Item span={[7, 12]}>Item B</Grid.Item> | ||
</Grid.Container>, | ||
) | ||
``` | ||
|
||
The columns do change based on what [breakpoint](/uilib/usage/layout/media-queries/) the browser is in: | ||
|
||
- 4 columns when `small` | ||
- 6 columns when `medium` | ||
- 12 columns when `large` | ||
|
||
<Examples.BasicSpan /> | ||
|
||
### Gap | ||
|
||
By default is no gap given. |
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
packages/dnb-design-system-portal/src/docs/uilib/components/grid/demos.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
showTabs: true | ||
--- | ||
|
||
import * as Examples from './Examples' | ||
|
||
## Demos | ||
|
||
### Responsive Grid.Container | ||
|
||
<Examples.ResponsiveGridContainer /> |
17 changes: 17 additions & 0 deletions
17
packages/dnb-design-system-portal/src/docs/uilib/components/grid/info.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
showTabs: true | ||
--- | ||
|
||
## Description | ||
|
||
To make it easier to build responsive application layouts in line with defined design sketches, there are a number of components for layout. | ||
|
||
- **[Grid.Container](/uilib/components/grid/container)** is a layout system for CSS grid based layout of contents. | ||
|
||
- **[Grid.Item](/uilib/components/grid/item)** is a layout system for CSS grid based layout of contents. | ||
|
||
You find more related information in the [Layout](/uilib/components/layout) pages. | ||
|
||
## Columns | ||
|
||
UX designers are using a 12 column system, along with a 4 and 6 column system, during their design processes. |
24 changes: 24 additions & 0 deletions
24
packages/dnb-design-system-portal/src/docs/uilib/components/grid/item.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: 'Grid.Item' | ||
description: '`Grid.Item` is a building block for CSS Grid based layouts.' | ||
hideInMenu: true | ||
showTabs: true | ||
tabs: | ||
- title: Info | ||
key: '/info' | ||
- title: Demos | ||
key: '/demos' | ||
- title: Properties | ||
key: '/properties' | ||
breadcrumb: | ||
- text: Grid | ||
href: /uilib/components/grid/ | ||
- text: Item | ||
href: /uilib/components/grid/item/ | ||
--- | ||
|
||
import Info from 'Docs/uilib/components/grid/item/info' | ||
import Demos from 'Docs/uilib/components/grid/item/demos' | ||
|
||
<Info /> | ||
<Demos /> |
Oops, something went wrong.