@react-ui-org/react-ui 0.44.1 → 0.47.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CONTRIBUTING.md +7 -0
- package/README.md +15 -16
- package/dist/lib.development.js +271 -415
- package/dist/lib.js +1 -1
- package/package.json +11 -13
- package/src/lib/components/Alert/Alert.jsx +45 -44
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/README.mdx +2 -5
- package/src/lib/components/Alert/_settings.scss +4 -4
- package/src/lib/components/Alert/_theme.scss +50 -50
- package/src/lib/components/Alert/_tools.scss +6 -6
- package/src/lib/components/Badge/Badge.jsx +9 -11
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +14 -13
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +11 -6
- package/src/lib/components/Button/_base.scss +69 -69
- package/src/lib/components/Button/_priorities.scss +49 -49
- package/src/lib/components/Button/_settings.scss +10 -10
- package/src/lib/components/Button/_theme.scss +18 -15
- package/src/lib/components/Button/_tools.scss +98 -100
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +41 -25
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +1 -1
- package/src/lib/components/Card/Card.jsx +10 -9
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +17 -12
- package/src/lib/components/Card/CardFooter.jsx +22 -9
- package/src/lib/components/Card/_theme.scss +50 -50
- package/src/lib/components/Card/_tools.scss +6 -6
- package/src/lib/components/CheckboxField/CheckboxField.jsx +21 -20
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +1 -1
- package/src/lib/components/FileInputField/FileInputField.jsx +16 -15
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FormLayout/FormLayout.jsx +19 -17
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +18 -12
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +26 -49
- package/src/lib/components/Grid/Grid.jsx +25 -24
- package/src/lib/components/Grid/Grid.scss +33 -29
- package/src/lib/components/Grid/GridSpan.jsx +11 -10
- package/src/lib/components/Grid/README.mdx +46 -20
- package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
- package/src/lib/components/Grid/_theme.scss +9 -9
- package/src/lib/components/Grid/_tools.scss +20 -20
- package/src/lib/components/Modal/Modal.jsx +38 -32
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -5
- package/src/lib/components/Modal/_settings.scss +5 -5
- package/src/lib/components/Modal/_theme.scss +17 -17
- package/src/lib/components/Paper/Paper.jsx +9 -9
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Popover/Popover.jsx +94 -0
- package/src/lib/components/Popover/Popover.scss +235 -0
- package/src/lib/components/Popover/PopoverWrapper.jsx +46 -0
- package/src/lib/components/Popover/README.mdx +333 -0
- package/src/lib/components/Popover/_helpers/getRootAlignmentClassName.js +13 -0
- package/src/lib/components/Popover/_helpers/getRootSideClassName.js +17 -0
- package/src/lib/components/Popover/_theme.scss +16 -0
- package/src/lib/components/Popover/index.js +2 -0
- package/src/lib/components/Radio/README.mdx +1 -1
- package/src/lib/components/Radio/Radio.jsx +15 -14
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +5 -5
- package/src/lib/components/ScrollView/ScrollView.jsx +22 -22
- package/src/lib/components/ScrollView/ScrollView.scss +113 -113
- package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
- package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
- package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
- package/src/lib/components/SelectField/README.mdx +1 -1
- package/src/lib/components/SelectField/SelectField.jsx +17 -16
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +1 -1
- package/src/lib/components/Table/Table.jsx +3 -3
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/Tabs.jsx +4 -5
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +7 -6
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/README.mdx +3 -3
- package/src/lib/components/Text/Text.jsx +16 -9
- package/src/lib/components/Text/Text.scss +23 -13
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
- package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
- package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
- package/src/lib/components/TextArea/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +21 -17
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/README.mdx +1 -1
- package/src/lib/components/TextField/TextField.jsx +19 -18
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/TextLink/TextLink.jsx +44 -0
- package/src/lib/components/TextLink/TextLink.scss +11 -0
- package/src/lib/components/TextLink/_theme.scss +4 -0
- package/src/lib/components/TextLink/index.js +1 -0
- package/src/lib/components/Toggle/README.mdx +1 -1
- package/src/lib/components/Toggle/Toggle.jsx +21 -20
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +33 -5
- package/src/lib/components/Toolbar/Toolbar.jsx +33 -17
- package/src/lib/components/Toolbar/Toolbar.scss +29 -42
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +28 -16
- package/src/lib/components/Toolbar/ToolbarItem.jsx +36 -10
- package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
- package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
- package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
- package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
- package/src/lib/foundation.scss +11 -11
- package/src/lib/helpers.scss +2 -2
- package/src/lib/index.js +8 -17
- package/src/lib/provider/index.js +2 -1
- package/src/lib/provider/withGlobalProps.jsx +21 -0
- package/src/lib/styles/_utilities.scss +13 -13
- package/src/lib/styles/elements/_code.scss +7 -7
- package/src/lib/styles/elements/_links.scss +8 -8
- package/src/lib/styles/elements/_lists.scss +3 -3
- package/src/lib/styles/elements/_page.scss +14 -14
- package/src/lib/styles/elements/_rulers.scss +6 -6
- package/src/lib/styles/elements/_small.scss +2 -2
- package/src/lib/styles/generic/_box-sizing.scss +3 -2
- package/src/lib/styles/generic/_forms.scss +3 -3
- package/src/lib/styles/generic/_reset.scss +6 -6
- package/src/lib/styles/generic/_shared.scss +3 -3
- package/src/lib/styles/helpers/_animation.scss +8 -8
- package/src/lib/styles/settings/_breakpoints.scss +7 -7
- package/src/lib/styles/settings/_escaped-characters.scss +5 -5
- package/src/lib/styles/settings/_form-fields.scss +24 -24
- package/src/lib/styles/settings/_utilities.scss +112 -100
- package/src/lib/styles/theme/_colors.scss +50 -50
- package/src/lib/styles/theme/_form-fields.scss +32 -32
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +12 -11
- package/src/lib/styles/theme-constants/_breakpoints.scss +4 -4
- package/src/lib/styles/theme-constants/_colors.scss +2 -2
- package/src/lib/styles/theme-constants/_svg.scss +1 -2
- package/src/lib/styles/tools/_accessibility.scss +29 -29
- package/src/lib/styles/tools/_breakpoint.scss +11 -14
- package/src/lib/styles/tools/_caret.scss +8 -8
- package/src/lib/styles/tools/_colors.scss +3 -3
- package/src/lib/styles/tools/_reset.scss +24 -21
- package/src/lib/styles/tools/_scrollbar.scss +4 -4
- package/src/lib/styles/tools/_spacing.scss +14 -22
- package/src/lib/styles/tools/_string.scss +9 -9
- package/src/lib/styles/tools/_svg.scss +13 -16
- package/src/lib/styles/tools/_transition.scss +42 -44
- package/src/lib/styles/tools/_utilities.scss +19 -19
- package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
- package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
- package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
- package/src/lib/theme.scss +959 -954
- package/src/lib/utils/classNames.js +8 -0
- package/src/lib/components/CTA/CTA.jsx +0 -60
- package/src/lib/components/CTA/CTA.scss +0 -71
- package/src/lib/components/CTA/CTACenter.jsx +0 -27
- package/src/lib/components/CTA/CTAEnd.jsx +0 -27
- package/src/lib/components/CTA/CTAStart.jsx +0 -27
- package/src/lib/components/CTA/README.mdx +0 -119
- package/src/lib/components/CTA/index.js +0 -4
- package/src/lib/components/Center/Center.jsx +0 -27
- package/src/lib/components/Center/Center.scss +0 -7
- package/src/lib/components/Center/README.mdx +0 -52
- package/src/lib/components/Center/index.js +0 -1
- package/src/lib/components/Link/Link.jsx +0 -45
- package/src/lib/components/Link/Link.scss +0 -11
- package/src/lib/components/Link/README.mdx +0 -85
- package/src/lib/components/Link/_theme.scss +0 -4
- package/src/lib/components/Link/index.js +0 -1
- package/src/lib/components/List/List.jsx +0 -71
- package/src/lib/components/List/List.scss +0 -53
- package/src/lib/components/List/ListItem.jsx +0 -31
- package/src/lib/components/List/README.mdx +0 -114
- package/src/lib/components/List/_theme.scss +0 -1
- package/src/lib/components/List/index.js +0 -2
- package/src/lib/components/Media/Media.jsx +0 -29
- package/src/lib/components/Media/Media.scss +0 -16
- package/src/lib/components/Media/MediaBody.jsx +0 -21
- package/src/lib/components/Media/MediaObject.jsx +0 -21
- package/src/lib/components/Media/README.mdx +0 -63
- package/src/lib/components/Media/index.js +0 -3
- package/src/lib/provider/withProviderContext.jsx +0 -32
@@ -1,53 +0,0 @@
|
|
1
|
-
@use '../../styles/tools/reset';
|
2
|
-
@use '../../styles/tools/spacing';
|
3
|
-
@use 'theme';
|
4
|
-
|
5
|
-
.root {
|
6
|
-
@include spacing.bottom(layouts);
|
7
|
-
}
|
8
|
-
|
9
|
-
.list {
|
10
|
-
@include reset.list();
|
11
|
-
|
12
|
-
display: flex;
|
13
|
-
flex-direction: column;
|
14
|
-
}
|
15
|
-
|
16
|
-
.item {
|
17
|
-
width: 100%;
|
18
|
-
margin-bottom: theme.$row-gap;
|
19
|
-
|
20
|
-
&:last-child {
|
21
|
-
margin-bottom: 0;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
.alignStart {
|
26
|
-
align-items: flex-start;
|
27
|
-
text-align: left;
|
28
|
-
}
|
29
|
-
|
30
|
-
.alignEnd {
|
31
|
-
align-items: flex-end;
|
32
|
-
text-align: right;
|
33
|
-
}
|
34
|
-
|
35
|
-
[dir="rtl"] .alignStart {
|
36
|
-
text-align: right;
|
37
|
-
}
|
38
|
-
|
39
|
-
[dir="rtl"] .alignEnd {
|
40
|
-
text-align: left;
|
41
|
-
}
|
42
|
-
|
43
|
-
.isAutoWidth .list {
|
44
|
-
display: inline-flex;
|
45
|
-
}
|
46
|
-
|
47
|
-
.isAutoWidth .item {
|
48
|
-
width: auto;
|
49
|
-
}
|
50
|
-
|
51
|
-
.item .root {
|
52
|
-
margin-bottom: 0;
|
53
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './List.scss';
|
5
|
-
|
6
|
-
export const ListItem = ({ children }) => {
|
7
|
-
if (!children) {
|
8
|
-
return null;
|
9
|
-
}
|
10
|
-
|
11
|
-
return (
|
12
|
-
<li className={styles.item}>
|
13
|
-
{children}
|
14
|
-
</li>
|
15
|
-
);
|
16
|
-
};
|
17
|
-
|
18
|
-
ListItem.defaultProps = {
|
19
|
-
children: null,
|
20
|
-
};
|
21
|
-
|
22
|
-
ListItem.propTypes = {
|
23
|
-
/**
|
24
|
-
* Content of the list item.
|
25
|
-
*/
|
26
|
-
children: PropTypes.node,
|
27
|
-
};
|
28
|
-
|
29
|
-
export const ListItemWithContext = withProviderContext(ListItem, 'ListItem');
|
30
|
-
|
31
|
-
export default ListItemWithContext;
|
@@ -1,114 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: List
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/list
|
5
|
-
---
|
6
|
-
|
7
|
-
# List
|
8
|
-
|
9
|
-
import {
|
10
|
-
Playground,
|
11
|
-
Props,
|
12
|
-
} from 'docz'
|
13
|
-
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
14
|
-
import { List } from './List'
|
15
|
-
import { ListItem } from './ListItem'
|
16
|
-
|
17
|
-
The List aligns content into an organized list.
|
18
|
-
|
19
|
-
## Basic Usage
|
20
|
-
|
21
|
-
To implement the List component, you need to import it first:
|
22
|
-
|
23
|
-
```js
|
24
|
-
import { List, ListItem } from '@react-ui-org/react-ui';
|
25
|
-
```
|
26
|
-
|
27
|
-
And use it:
|
28
|
-
|
29
|
-
<Playground>
|
30
|
-
<List>
|
31
|
-
<ListItem>
|
32
|
-
<Placeholder bordered>List item</Placeholder>
|
33
|
-
</ListItem>
|
34
|
-
<ListItem>
|
35
|
-
<Placeholder bordered>List item</Placeholder>
|
36
|
-
</ListItem>
|
37
|
-
<ListItem>
|
38
|
-
<Placeholder bordered>List item</Placeholder>
|
39
|
-
</ListItem>
|
40
|
-
</List>
|
41
|
-
</Playground>
|
42
|
-
|
43
|
-
See [API](#api) for all available options.
|
44
|
-
|
45
|
-
## General Guidelines
|
46
|
-
|
47
|
-
- **Wrap your items** into the [ListItem](#listitem) component. This ensures
|
48
|
-
your content is properly spaced and aligned with other List elements. Do
|
49
|
-
**not** try to put any custom HTML or React components directly into the
|
50
|
-
List layout without wrapping it with the ListItem first.
|
51
|
-
|
52
|
-
- For forms, use rather the [FormLayout](/components/form-layout)
|
53
|
-
component which is designed specifically for that purpose.
|
54
|
-
|
55
|
-
## List Alignment
|
56
|
-
|
57
|
-
You can simply set the list alignment by specifying the `align` option.
|
58
|
-
|
59
|
-
👉 At the current stage of development, React UI is **RTL aware** so switching
|
60
|
-
to a fully RTL-compatible behavior in the future should be painless. That's why
|
61
|
-
the alignment values are called rather `start` than `left` and `end` instead of
|
62
|
-
`right`.
|
63
|
-
|
64
|
-
<Playground>
|
65
|
-
<List align="end">
|
66
|
-
<ListItem>
|
67
|
-
<Placeholder bordered>List item</Placeholder>
|
68
|
-
</ListItem>
|
69
|
-
<ListItem>
|
70
|
-
<Placeholder bordered>List item</Placeholder>
|
71
|
-
</ListItem>
|
72
|
-
<ListItem>
|
73
|
-
<Placeholder bordered>List item</Placeholder>
|
74
|
-
</ListItem>
|
75
|
-
</List>
|
76
|
-
</Playground>
|
77
|
-
|
78
|
-
## Auto Width
|
79
|
-
|
80
|
-
For cases when you prefer the list items to keep their original width and don't
|
81
|
-
want them to expand over the full width of the parent of the list, there is the
|
82
|
-
`autoWidth` option. It **shrinks the list according to its longest item.**
|
83
|
-
However, the root div always behaves as a full-width block element (unless you
|
84
|
-
put it inside a flex or grid layout).
|
85
|
-
|
86
|
-
<Playground>
|
87
|
-
<List align="end" autoWidth>
|
88
|
-
<ListItem>
|
89
|
-
<Placeholder bordered>List item</Placeholder>
|
90
|
-
</ListItem>
|
91
|
-
<ListItem>
|
92
|
-
<Placeholder bordered>List item that is longer</Placeholder>
|
93
|
-
</ListItem>
|
94
|
-
<ListItem>
|
95
|
-
<Placeholder bordered>List item that is even a bit longer</Placeholder>
|
96
|
-
</ListItem>
|
97
|
-
</List>
|
98
|
-
</Playground>
|
99
|
-
|
100
|
-
## API
|
101
|
-
|
102
|
-
<Props table of={List} />
|
103
|
-
|
104
|
-
### ListItem API
|
105
|
-
|
106
|
-
A wrapper for individual list items.
|
107
|
-
|
108
|
-
<Props table of={ListItem} />
|
109
|
-
|
110
|
-
## Theming
|
111
|
-
|
112
|
-
| Custom Property | Description |
|
113
|
-
|------------------------------------------------------|--------------------------------------------------------------|
|
114
|
-
| `--rui-List__row-gap` | Gap between list items |
|
@@ -1 +0,0 @@
|
|
1
|
-
$row-gap: var(--rui-List__row-gap);
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './Media.scss';
|
5
|
-
|
6
|
-
export const Media = (props) => {
|
7
|
-
const {
|
8
|
-
children,
|
9
|
-
} = props;
|
10
|
-
|
11
|
-
return (
|
12
|
-
<div className={styles.media}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
16
|
-
};
|
17
|
-
|
18
|
-
Media.propTypes = {
|
19
|
-
/**
|
20
|
-
* Nested elements. Supported types are:
|
21
|
-
* * `MediaBody`
|
22
|
-
* * `MediaObject`
|
23
|
-
*/
|
24
|
-
children: PropTypes.node.isRequired,
|
25
|
-
};
|
26
|
-
|
27
|
-
export const MediaWithContext = withProviderContext(Media, 'Media');
|
28
|
-
|
29
|
-
export default MediaWithContext;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './Media.scss';
|
5
|
-
|
6
|
-
export const MediaBody = ({ children }) => (
|
7
|
-
<div className={styles.body}>
|
8
|
-
{children}
|
9
|
-
</div>
|
10
|
-
);
|
11
|
-
|
12
|
-
MediaBody.propTypes = {
|
13
|
-
/**
|
14
|
-
* Content of the media layout.
|
15
|
-
*/
|
16
|
-
children: PropTypes.node.isRequired,
|
17
|
-
};
|
18
|
-
|
19
|
-
export const MediaBodyWithContext = withProviderContext(MediaBody, 'MediaBody');
|
20
|
-
|
21
|
-
export default MediaBodyWithContext;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import { withProviderContext } from '../../provider';
|
4
|
-
import styles from './Media.scss';
|
5
|
-
|
6
|
-
export const MediaObject = ({ children }) => (
|
7
|
-
<div className={styles.object}>
|
8
|
-
{children}
|
9
|
-
</div>
|
10
|
-
);
|
11
|
-
|
12
|
-
MediaObject.propTypes = {
|
13
|
-
/**
|
14
|
-
* Accompanying media object for the Media layout, eg. an image.
|
15
|
-
*/
|
16
|
-
children: PropTypes.node.isRequired,
|
17
|
-
};
|
18
|
-
|
19
|
-
export const MediaObjectWithContext = withProviderContext(MediaObject, 'MediaObject');
|
20
|
-
|
21
|
-
export default MediaObjectWithContext;
|
@@ -1,63 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Media
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/media
|
5
|
-
---
|
6
|
-
|
7
|
-
# Media
|
8
|
-
|
9
|
-
import {
|
10
|
-
Playground,
|
11
|
-
Props,
|
12
|
-
} from 'docz'
|
13
|
-
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
14
|
-
import { Media } from './Media'
|
15
|
-
import { MediaBody } from './MediaBody'
|
16
|
-
import { MediaObject } from './MediaObject'
|
17
|
-
|
18
|
-
The Media layout nicely aligns text content next to an object.
|
19
|
-
|
20
|
-
## Basic Usage
|
21
|
-
|
22
|
-
To implement the Media component, you need to import it first:
|
23
|
-
|
24
|
-
```js
|
25
|
-
import { Media, MediaBody, MediaObject } from '@react-ui-org/react-ui';
|
26
|
-
```
|
27
|
-
|
28
|
-
And use it:
|
29
|
-
|
30
|
-
<Playground>
|
31
|
-
<Media>
|
32
|
-
<MediaObject>
|
33
|
-
<Placeholder bordered>Media object</Placeholder>
|
34
|
-
</MediaObject>
|
35
|
-
<MediaBody>
|
36
|
-
<Placeholder bordered>Media body</Placeholder>
|
37
|
-
</MediaBody>
|
38
|
-
</Media>
|
39
|
-
</Playground>
|
40
|
-
|
41
|
-
See [API](#api) for all available options.
|
42
|
-
|
43
|
-
## General Guidelines
|
44
|
-
|
45
|
-
Use the Media layout for **highly repetitive layouts** like comments, article
|
46
|
-
teasers, etc., ie. when you need a **fixed-sized object** (e.g. an image) and an
|
47
|
-
**area that expands** over the remaining horizontal space (e.g. a paragraph).
|
48
|
-
|
49
|
-
## API
|
50
|
-
|
51
|
-
<Props table of={Media} />
|
52
|
-
|
53
|
-
### MediaBody
|
54
|
-
|
55
|
-
A place for the text content.
|
56
|
-
|
57
|
-
<Props table of={MediaBody} />
|
58
|
-
|
59
|
-
### MediaObject
|
60
|
-
|
61
|
-
A place for the media object.
|
62
|
-
|
63
|
-
<Props table of={MediaObject} />
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import RUIContext from './RUIContext';
|
4
|
-
|
5
|
-
export default (Component, componentName) => {
|
6
|
-
const WithProviderContextComponent = (props) => (
|
7
|
-
<RUIContext.Consumer>
|
8
|
-
{(context) => {
|
9
|
-
const contextGlobalProps = context?.globalProps ? context.globalProps[componentName] : null;
|
10
|
-
const contextTranslations = context?.translations ? context.translations[componentName] : null;
|
11
|
-
|
12
|
-
return (
|
13
|
-
<Component
|
14
|
-
{...contextGlobalProps}
|
15
|
-
{...props}
|
16
|
-
translations={props.translations || contextTranslations}
|
17
|
-
/>
|
18
|
-
);
|
19
|
-
}}
|
20
|
-
</RUIContext.Consumer>
|
21
|
-
);
|
22
|
-
|
23
|
-
WithProviderContextComponent.defaultProps = {
|
24
|
-
translations: undefined,
|
25
|
-
};
|
26
|
-
|
27
|
-
WithProviderContextComponent.propTypes = {
|
28
|
-
translations: PropTypes.shape({}),
|
29
|
-
};
|
30
|
-
|
31
|
-
return WithProviderContextComponent;
|
32
|
-
};
|