-
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.
feat(Flex): add new Flex layout component
- Loading branch information
1 parent
cf0d5b6
commit db1c627
Showing
99 changed files
with
827 additions
and
820 deletions.
There are no files selected for viewing
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
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
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
24 changes: 24 additions & 0 deletions
24
packages/dnb-design-system-portal/src/docs/uilib/components/flex/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: 'Flex.Container' | ||
description: '`Flex.Container` 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: Layout | ||
href: /uilib/components/layout/ | ||
- text: Flex.Container | ||
href: /uilib/components/flex/container/ | ||
--- | ||
|
||
import Info from 'Docs/uilib/components/flex/container/info' | ||
import Demos from 'Docs/uilib/components/flex/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
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
41 changes: 41 additions & 0 deletions
41
...ages/dnb-design-system-portal/src/docs/uilib/components/flex/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,41 @@ | ||
--- | ||
showTabs: true | ||
--- | ||
|
||
## Description | ||
|
||
`Flex.Container` is a building block for [CSS flexbox](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout) based layout of contents and components. | ||
|
||
Ideally, use [Flex.Item](/uilib/components/flex/item) or [Card](/uilib/components/card) for you inner wrappers. | ||
|
||
## How spacing is applied | ||
|
||
Nested components should preferably support [spacing properties](/uilib/components/space/). | ||
|
||
When a element or component was given, that does not support spacing, it will still work out of the box as it gets wrapped in a spacing block. | ||
|
||
You may else wrap your custom component in a `Flex.Item` – this way, you still can change the spacing per component basis. | ||
|
||
Technically, `Flex.Container` checks if a nested component has a property called `_supportsEufemiaSpacingProps`. So if you have a component that supports the [spacing properties](/uilib/components/space/), you can add this property `ComponentName._supportsEufemiaSpacingProps = true`. | ||
|
||
### Horizontal and Vertical aliases | ||
|
||
For shortening the usage of `direction="..."`, you can use: | ||
|
||
- `<Flex.Vertical>` instead of `<Flex.Container direction="vertical">` | ||
|
||
```jsx | ||
<Flex.Vertical> | ||
<Flex.Item>part of vertical alignment</Flex.Item> | ||
<Flex.Item>part of vertical alignment</Flex.Item> | ||
</Flex.Vertical> | ||
``` | ||
|
||
- `<Flex.Horizontal>` instead of `<Flex.Container direction="horizontal">` | ||
|
||
```jsx | ||
<Flex.Horizontal> | ||
<Flex.Item>part of horizontal alignment</Flex.Item> | ||
<Flex.Item>part of horizontal alignment</Flex.Item> | ||
</Flex.Horizontal> | ||
``` |
Oops, something went wrong.