Skip to content

Commit cd5fe25

Browse files
authored
Divider docs (#198)
1 parent 377d3ff commit cd5fe25

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

packages/@adobe/spectrum-css-temp/components/rule/index.css

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ governing permissions and limitations under the License.
1919
border: none;
2020
border-width: var(--spectrum-rule-medium-height);
2121
border-radius: var(--spectrum-rule-medium-height);
22+
23+
/* hr elements are given a default margin, reset it so that flex can work */
24+
margin: 0px;
25+
margin-inline-start: 0px;
26+
margin-inline-end: 0px;
27+
align-self: stretch;
2228
}
2329

2430
.spectrum-Rule--large {
@@ -48,6 +54,7 @@ governing permissions and limitations under the License.
4854
}
4955

5056
.spectrum-Rule--vertical {
57+
height: auto;
5158
/* expected usage, people need to set height 100% if they aren't using flex on the container
5259
* if they *ARE* using flex, then they need to either have align-items stretch OR align-self stretch
5360
*/

packages/@react-spectrum/button/docs/Button.mdx

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import {Layout} from '@react-spectrum/docs';
22
export default Layout;
33

44
import docs from 'docs:@react-spectrum/button';
5-
import {PropTable} from '@react-spectrum/docs';
5+
import {HeaderInfo, PropTable} from '@react-spectrum/docs';
66
import packageData from '../package.json';
7-
import {HeaderInfo} from '@react-spectrum/docs';
87

98
```jsx import
109
import {Button} from '@react-spectrum/button';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import {Layout} from '@react-spectrum/docs';
2+
export default Layout;
3+
4+
import docs from 'docs:@react-spectrum/divider';
5+
import {HeaderInfo, PropTable} from '@react-spectrum/docs';
6+
import packageData from '../package.json';
7+
8+
```jsx import
9+
import {Divider} from '@react-spectrum/divider';
10+
import {Flex} from '@react-spectrum/layout';
11+
```
12+
13+
# Divider
14+
15+
<p>{docs.exports.Divider.description}</p>
16+
17+
<HeaderInfo
18+
packageData={packageData}
19+
componentNames={['Divider']}
20+
sourceData={[
21+
{type: 'Spectrum', url: 'https://spectrum.adobe.com/page/rule/'}
22+
]} />
23+
24+
## Example
25+
26+
### Horizontal
27+
28+
Horizontal Dividers can be used as is because of how CSS Layout works. They may also be used in Flex and Grid containers.
29+
```tsx example
30+
Content above
31+
<Divider marginTop="10px" marginBottom="10px" />
32+
Content below
33+
```
34+
35+
### Vertical
36+
37+
It is recommended to only use vertical Dividers in Flex or Grid containers. CSS Layout otherwise makes displaying a vertical Divider very difficult.
38+
```tsx example
39+
<Flex>
40+
Content left
41+
<Divider orientation="vertical" marginLeft="10px" marginRight="10px" />
42+
Content right
43+
</Flex>
44+
```
45+
46+
## Props
47+
48+
<PropTable component={docs.exports.Divider} links={docs.links} />

packages/@react-spectrum/utils/src/styleProps.ts

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export const baseStyleProps: StyleHandlers = {
2828
maxWidth: ['maxWidth', dimensionValue],
2929
maxHeight: ['maxHeight', dimensionValue],
3030
isHidden: ['display', hiddenValue],
31+
alignSelf: ['alignSelf', passthroughStyle],
32+
justifySelf: ['justifySelf', passthroughStyle],
3133
position: ['position', anyValue],
3234
zIndex: ['zIndex', anyValue],
3335
top: ['top', dimensionValue],

0 commit comments

Comments
 (0)