Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Columns/Column styles to not rely on Stack styles #508

Merged
merged 2 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions src/new-components/columns/columns.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,139 @@
.columnWidth-4-5 {
flex: 0 0 80%;
}

/* styles for whan stacked */

/* Default vertical spacing */
.space-xsmall {
margin-top: calc(var(--reactist-spacing-xsmall) * -1);
}
.space-xsmall > * {
margin-top: var(--reactist-spacing-xsmall);
}

.space-small {
margin-top: calc(var(--reactist-spacing-small) * -1);
}
.space-small > * {
margin-top: var(--reactist-spacing-small);
}

.space-medium {
margin-top: calc(var(--reactist-spacing-medium) * -1);
}
.space-medium > * {
margin-top: var(--reactist-spacing-medium);
}

.space-large {
margin-top: calc(var(--reactist-spacing-large) * -1);
}
.space-large > * {
margin-top: var(--reactist-spacing-large);
}

.space-xlarge {
margin-top: calc(var(--reactist-spacing-xlarge) * -1);
}
.space-xlarge > * {
margin-top: var(--reactist-spacing-xlarge);
}

.space-xxlarge {
margin-top: calc(var(--reactist-spacing-xxlarge) * -1);
}
.space-xxlarge > * {
margin-top: var(--reactist-spacing-xxlarge);
}

/* Vertical spacing in tablet */
@media (min-width: 768px /* --reactist-breakpoint-tablet */) {
.tablet-space-xsmall {
margin-top: calc(var(--reactist-spacing-xsmall) * -1);
}
.tablet-tablet-space-xsmall > * {
margin-top: var(--reactist-spacing-xsmall);
}

.tablet-space-small {
margin-top: calc(var(--reactist-spacing-small) * -1);
}
.tablet-space-small > * {
margin-top: var(--reactist-spacing-small);
}

.tablet-space-medium {
margin-top: calc(var(--reactist-spacing-medium) * -1);
}
.tablet-space-medium > * {
margin-top: var(--reactist-spacing-medium);
}

.tablet-space-large {
margin-top: calc(var(--reactist-spacing-large) * -1);
}
.tablet-space-large > * {
margin-top: var(--reactist-spacing-large);
}

.tablet-space-xlarge {
margin-top: calc(var(--reactist-spacing-xlarge) * -1);
}
.tablet-space-xlarge > * {
margin-top: var(--reactist-spacing-xlarge);
}

.tablet-space-xxlarge {
margin-top: calc(var(--reactist-spacing-xxlarge) * -1);
}
.tablet-space-xxlarge > * {
margin-top: var(--reactist-spacing-xxlarge);
}
}

/* Vertical spacing in desktop */

@media (min-width: 992px /* --reactist-breakpoint-desktop */) {
.desktop-space-xsmall {
margin-top: calc(var(--reactist-spacing-xsmall) * -1);
}
.desktop-space-xsmall > * {
margin-top: var(--reactist-spacing-xsmall);
}

.desktop-space-small {
margin-top: calc(var(--reactist-spacing-small) * -1);
}
.desktop-space-small > * {
margin-top: var(--reactist-spacing-small);
}

.desktop-space-medium {
margin-top: calc(var(--reactist-spacing-medium) * -1);
}
.desktop-space-medium > * {
margin-top: var(--reactist-spacing-medium);
}

.desktop-space-large {
margin-top: calc(var(--reactist-spacing-large) * -1);
}
.desktop-space-large > * {
margin-top: var(--reactist-spacing-large);
}

.desktop-space-xlarge {
margin-top: calc(var(--reactist-spacing-xlarge) * -1);
}
.desktop-space-xlarge > * {
margin-top: var(--reactist-spacing-xlarge);
}

.desktop-space-xxlarge {
margin-top: calc(var(--reactist-spacing-xxlarge) * -1);
}
.desktop-space-xxlarge > * {
margin-top: var(--reactist-spacing-xxlarge);
}
}
8 changes: 2 additions & 6 deletions src/new-components/columns/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type { Space } from '../common-types'
import type { ReusableBoxProps } from '../box'

import styles from './columns.module.css'
import stackStyles from '../stack/stack.module.css'

type ColumnWidth =
| 'auto'
Expand Down Expand Up @@ -67,10 +66,8 @@ const Columns = forwardRefWithAs<ColumnsProps>(function Columns(
) {
return (
<Box
className={[
getClassNames(styles, 'space', space),
getClassNames(stackStyles, 'space', space),
]}
{...props}
className={getClassNames(styles, 'space', space)}
flexDirection={
collapseBelow === 'desktop'
? ['column', 'column', 'row']
Expand All @@ -86,7 +83,6 @@ const Columns = forwardRefWithAs<ColumnsProps>(function Columns(
align === 'left' ? 'flexStart' : align === 'right' ? 'flexEnd' : 'center',
)}
ref={ref}
{...props}
>
{children}
</Box>
Expand Down