Skip to content

Commit

Permalink
Merge pull request #26 from etchteam/feature/etch-393-add-fluid-spacing
Browse files Browse the repository at this point in the history
feat: fluid spacing
  • Loading branch information
gavmck authored Feb 9, 2024
2 parents 3929f32 + e61da02 commit a17479f
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 5 deletions.
13 changes: 13 additions & 0 deletions components/canvas/Card/Card.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ diamond-card {

&[radius] {
border-radius: var(--diamond-radius);
overflow: hidden;
}

&[padding='xs'] {
Expand All @@ -34,6 +35,18 @@ diamond-card {
padding: var(--diamond-spacing-xl);
}

&[padding='fluid-sm'] {
padding: var(--diamond-spacing-fluid-sm);
}

&[padding='fluid'] {
padding: var(--diamond-spacing-fluid);
}

&[padding='fluid-lg'] {
padding: var(--diamond-spacing-fluid-lg);
}

&[padding='none'] {
padding: 0;
}
Expand Down
12 changes: 11 additions & 1 deletion components/canvas/Card/Card.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,17 @@ export default {
control: {
type: 'select',
},
options: ['xs', 'sm', 'md', 'lg', 'xl', 'none'],
options: [
'xs',
'sm',
'md',
'lg',
'xl',
'fluid-sm',
'fluid',
'fluid-lg',
'none',
],
},
},
};
Expand Down
11 changes: 10 additions & 1 deletion components/canvas/Card/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ export interface CardAttributes {
shadow?: boolean;
muted?: boolean;
radius?: boolean;
padding?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none';
padding?:
| 'xs'
| 'sm'
| 'md'
| 'lg'
| 'xl'
| 'fluid-sm'
| 'fluid'
| 'fluid-lg'
| 'none';
}

declare global {
Expand Down
12 changes: 12 additions & 0 deletions components/canvas/Section/Section.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ diamond-section {
padding-block: var(--diamond-spacing-xl);
}

&[padding='fluid-sm'] {
padding: var(--diamond-spacing-fluid-sm);
}

&[padding='fluid'] {
padding: var(--diamond-spacing-fluid);
}

&[padding='fluid-lg'] {
padding: var(--diamond-spacing-fluid-lg);
}

&[padding='none'] {
padding-block: 0;
}
Expand Down
12 changes: 11 additions & 1 deletion components/canvas/Section/Section.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ export default {
control: {
type: 'select',
},
options: ['xs', 'sm', 'md', 'lg', 'xl', 'none'],
options: [
'xs',
'sm',
'md',
'lg',
'xl',
'fluid-sm',
'fluid',
'fluid-lg',
'none',
],
},
},
};
Expand Down
11 changes: 10 additions & 1 deletion components/canvas/Section/Section.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { JSXCustomElement } from '../../../types/jsx-custom-element';

export interface SectionAttributes {
padding?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none';
padding?:
| 'xs'
| 'sm'
| 'md'
| 'lg'
| 'xl'
| 'fluid-sm'
| 'fluid'
| 'fluid-lg'
| 'none';
}

declare global {
Expand Down
24 changes: 24 additions & 0 deletions components/composition/Spacing/Spacing.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
margin-top: var(--diamond-spacing-xl);
}

.diamond-spacing-top-fluid {
margin-top: var(--diamond-spacing-fluid);
}

.diamond-spacing-top-fluid-sm {
margin-top: var(--diamond-spacing-fluid-sm);
}

.diamond-spacing-top-fluid-lg {
margin-top: var(--diamond-spacing-fluid-lg);
}

/* bottom */

.diamond-spacing-bottom-xs {
Expand All @@ -41,3 +53,15 @@
.diamond-spacing-bottom-xl {
margin-bottom: var(--diamond-spacing-xl);
}

.diamond-spacing-bottom-fluid {
margin-bottom: var(--diamond-spacing-fluid);
}

.diamond-spacing-bottom-fluid-sm {
margin-bottom: var(--diamond-spacing-fluid-sm);
}

.diamond-spacing-bottom-fluid-lg {
margin-bottom: var(--diamond-spacing-fluid-lg);
}
2 changes: 1 addition & 1 deletion components/composition/Spacing/Spacing.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
argTypes: {
size: {
control: { type: 'select' },
options: ['xs', 'sm', 'md', 'lg', 'xl'],
options: ['xs', 'sm', 'md', 'lg', 'xl', 'fluid', 'fluid-sm', 'fluid-lg'],
},
},
};
Expand Down
4 changes: 4 additions & 0 deletions styles/tokens/spacing.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
--diamond-spacing-sm: calc(var(--diamond-spacing) / 2);
--diamond-spacing-lg: calc(var(--diamond-spacing) * 2);
--diamond-spacing-xl: calc(var(--diamond-spacing) * 4);

--diamond-spacing-fluid: clamp(1rem, 5vw, 4rem);
--diamond-spacing-fluid-sm: clamp(1rem, 5vw, 3rem);
--diamond-spacing-fluid-lg: clamp(1rem, 5vw, 5rem);
}

0 comments on commit a17479f

Please sign in to comment.