Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
feat(InlineList): Support additional styleProps
Browse files Browse the repository at this point in the history
Style props for positioning, text styling, and sizing
are now support by the InlineList component
  • Loading branch information
diondiondion committed Feb 27, 2020
1 parent d9c6415 commit 5f455ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/InlineList/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import InlineList from './';

Lay out children horizontally with optional spacing or separators.

Supports styleProps `position`, `text`, and `size`.

<Playground>
<InlineList spacing="s">
<Icon name="asset-image" />
Expand All @@ -22,10 +24,10 @@ Lay out children horizontally with optional spacing or separators.
</InlineList>

<InlineList splitBy="comma">
<span>Milk</span>
<span>Flour</span>
<span>Sugar</span>
<span>Eggs</span>
<>Milk</>
<>Flour</>
<>Sugar</>
<>Eggs</>
</InlineList>

<InlineList splitBy="dot">
Expand Down
10 changes: 10 additions & 0 deletions src/InlineList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import styled, {css} from 'styled-components';

import {getSpacing} from '../utils';

import {positionProps, sizeProps, textProps} from '../styleProps';

const Item = styled.li`
display: ${p => p.display || 'inline-block'};
max-width: 100%;
Expand All @@ -15,6 +17,7 @@ Item.propTypes = {
const getSpacingFromTheme = p => getSpacing(p.spacing, p.theme);

const Wrapper = styled.ul`
${positionProps}
list-style: none;
margin: 0;
padding: 0;
Expand All @@ -27,6 +30,9 @@ const Wrapper = styled.ul`
margin-bottom: -${getSpacingFromTheme};
`}
${sizeProps}
${textProps}
& > ${Item} {
vertical-align: ${p => p.align || 'top'};
Expand Down Expand Up @@ -72,6 +78,10 @@ const InlineList = ({as, itemAs, children, display, ...otherProps}) => {
</Wrapper>
);
};
InlineList.defaultProps = {
as: 'ul',
itemAs: 'li',
};
InlineList.propTypes = {
/**
* Vertical alignment of list items
Expand Down

0 comments on commit 5f455ab

Please sign in to comment.