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

Commit

Permalink
Add orientation prop to Level
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Aug 4, 2020
1 parent 7b8933a commit 6d0de2a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions packages/bumbag/src/Level/Level.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { Flex, FlexProps } from '../Flex';
import * as styles from './styles';

export type LocalLevelProps = {
/** Sets the orientation of the level. */
orientation?: 'vertical' | 'horizontal';
/** Sets the spacing of the level when it snaps to a vertical orientation. */
spacing?: string;
/** Sets the breakpoint at which the level should become vertical. */
Expand Down
31 changes: 22 additions & 9 deletions packages/bumbag/src/Level/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,30 @@ const verticalBreakpoints = {

export const Level = (styleProps) => cssClass`
&&& {
${breakpoint(styleProps.verticalBelow ? `max-${verticalBreakpoints[styleProps.verticalBelow]}` : null, css`
flex-direction: column;
${breakpoint(
styleProps.orientation === 'horizontal' && styleProps.verticalBelow
? `max-${verticalBreakpoints[styleProps.verticalBelow]}`
: null,
css`
flex-direction: column;
& > *:not(:last-child) {
margin-bottom: ${space(styleProps.spacing)(styleProps)}rem;
}
& > *:not(:last-child) {
margin-bottom: ${space(styleProps.spacing)(styleProps)}rem;
}
${getAlignmentAttributes(styleProps)}
`, { else: css`
justify-content: space-between;
` })(styleProps)};
${getAlignmentAttributes(styleProps)}
`,
{
else: css`
justify-content: space-between;
${styleProps.orientation === 'vertical' &&
css`
flex-direction: column;
`}
`,
}
)(styleProps)};
}
Expand Down

0 comments on commit 6d0de2a

Please sign in to comment.