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

Commit

Permalink
fix: Fix broken Button alignment after refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
diondiondion committed Sep 3, 2019
1 parent 6600bc4 commit d8089e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Button/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ Nice looking buttons, yo.
Done
</Button>
</InlineList>
<br />
<Button fullWidth color="primary" icon="ok">
Login
</Button>
<br />
<Button fullWidth align="left" size="large" color="shaded" icon="plus">
Add to My learning
</Button>
</Playground>

## Props
Expand Down
6 changes: 5 additions & 1 deletion src/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {pxToRem} from '../utils/units';
import {fillParent} from '../mixins';

import {positionProps, marginProps} from '../styleProps';
import {alignMap} from '../styleProps/flexProps';

import ButtonCore from '../ButtonCore';
import Icon from '../Icon';
Expand Down Expand Up @@ -201,6 +202,7 @@ const Content = styled.span`
position: relative;
display: flex;
align-items: center;
justify-content: ${p => (p.align ? alignMap[p.align] : 'center')};
`;

const ButtonText = styled.span`
Expand All @@ -210,6 +212,7 @@ const ButtonText = styled.span`

function ButtonWithRef(props, ref) {
const {
align,
as,
children,
color = 'default',
Expand All @@ -228,11 +231,12 @@ function ButtonWithRef(props, ref) {
buttonRef={ref}
aria-label={props['aria-label'] || title}
color={color}
align={align}
{...otherProps}
>
<HoverShade />
<FocusRing color={color} />
<Content>
<Content align={align}>
{!iconRight && iconEl}
{children && <ButtonText>{children}</ButtonText>}
{iconRight && iconEl}
Expand Down

0 comments on commit d8089e5

Please sign in to comment.