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

feat: Add Breakout component that lets media content stick out of a Spotlight #1397

Merged
merged 54 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
aa4f1bc
Add initial ‘stick out’ story with minimal API changes
VincentSmedinga Jul 14, 2024
70e8b68
Generalize GridColumnNumbers type to ResponsiveGridValues
VincentSmedinga Jul 15, 2024
9c10927
Add row span and start props to Grid Cell
VincentSmedinga Jul 15, 2024
a9b48b1
Use new row props of Grid Cell in Stick Out Spotlight story
VincentSmedinga Jul 15, 2024
30d34b6
Stack image and text vertically in medium grid as well
VincentSmedinga Jul 15, 2024
8c1c16c
Add example of spanning rows
VincentSmedinga Jul 15, 2024
e61884c
Wrap Spotlight examples in Screen to prevent ‘stick out’ example from…
VincentSmedinga Jul 15, 2024
2e17c55
Accommodate negative margin at the bottom
VincentSmedinga Jul 15, 2024
df8ff56
Document importing story components from source
VincentSmedinga Sep 9, 2024
ab7a701
Update docs class for recent changes
VincentSmedinga Sep 9, 2024
ad6db73
Support spanning 4 rows, extract variables
VincentSmedinga Sep 10, 2024
5dbefbf
Allow grid cells to cover their adjacent whitespace
VincentSmedinga Sep 11, 2024
bdf031b
Merge branch 'develop' into feature/DES-802-stick-out-grid
VincentSmedinga Sep 11, 2024
7397dd3
Add required prop to cell covering gap
VincentSmedinga Sep 11, 2024
f28e804
Describe and move the example
VincentSmedinga Sep 11, 2024
59c54cd
Merge branch 'develop' into feature/DES-802-stick-out-grid
VincentSmedinga Sep 13, 2024
beb304b
Copy Grid to new Breakout component
VincentSmedinga Sep 13, 2024
20baca9
Update documentation for Breakout
VincentSmedinga Sep 13, 2024
e83319d
Prefix `span` and `start` with `col`
VincentSmedinga Sep 13, 2024
c771849
Remove `coverGap` prop from `Grid.Cell`
VincentSmedinga Sep 13, 2024
201d6c0
Remove row props from Grid
VincentSmedinga Sep 13, 2024
e8bac64
Extract shared type
VincentSmedinga Sep 13, 2024
491d6dd
Reuse Grid styles in Breakout
VincentSmedinga Sep 13, 2024
e9f0dd5
Move type back into Grid
VincentSmedinga Sep 13, 2024
231a7ac
Wrap Spotlight examples in Screen for max width
VincentSmedinga Sep 13, 2024
af9ba3a
Remove JSX fragments from stories
VincentSmedinga Sep 13, 2024
391ae2d
Extract grid mixins for reuse in Grid and Breakout
VincentSmedinga Sep 18, 2024
9873fdb
Merge branch 'develop' into feature/DES-802-stick-out-grid
VincentSmedinga Sep 18, 2024
e28026d
Remove unused tokens for Breakout
VincentSmedinga Sep 18, 2024
6436fbe
Restore example for a cell covering gaps
VincentSmedinga Sep 18, 2024
51931c1
Reuse GridProps type in Breakout
VincentSmedinga Sep 18, 2024
1508ed8
Extract shared function
VincentSmedinga Sep 18, 2024
8929ba1
Add tests for `rowStart` and `rowSpan` props
VincentSmedinga Sep 18, 2024
6add1ff
Extract and improve generation of grid classes
VincentSmedinga Sep 18, 2024
2a398dc
Replace lorem ipsum with example paragraph
VincentSmedinga Sep 18, 2024
00a894f
Remove Heading from example
VincentSmedinga Sep 18, 2024
782bb93
Replace type assertion with explicit type
VincentSmedinga Sep 18, 2024
113d4a0
Fix types
VincentSmedinga Sep 18, 2024
8aa4ceb
Merge branch 'develop' into feature/DES-802-stick-out-grid
VincentSmedinga Sep 19, 2024
81b1264
Apply suggestions from code review
VincentSmedinga Sep 24, 2024
db0c853
Apply suggestions from code review
VincentSmedinga Sep 25, 2024
074225c
Stop support for paragraphs in pink boxes
VincentSmedinga Sep 24, 2024
0e0a59f
Generate only necessary classes for narrow grid
VincentSmedinga Sep 24, 2024
fb7a4b6
Reuse Grid types in Breakout
VincentSmedinga Sep 25, 2024
8e10d87
Fix test descriptions
VincentSmedinga Sep 25, 2024
693cac0
Ensure example content always results in breaking out
VincentSmedinga Sep 25, 2024
cf74ff8
Keep some types internal
VincentSmedinga Sep 25, 2024
40a3165
Remove coverGap example until we get the controls to work
VincentSmedinga Sep 25, 2024
b3f2c69
Revert ResponsiveGridValues generic
VincentSmedinga Sep 25, 2024
c9eac5a
Revert partial bug fix of generating too much classes
VincentSmedinga Sep 25, 2024
0d1f859
Revert partial bug fix of generating too much classes
VincentSmedinga Sep 25, 2024
d63905c
Replace inline styles and `coverGap` prop with `has` prop
VincentSmedinga Sep 25, 2024
041e2cc
Merge branch 'develop' into feature/DES-802-stick-out-grid
VincentSmedinga Sep 25, 2024
bc3ac3a
Revert breaking change for now
VincentSmedinga Sep 25, 2024
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
8 changes: 5 additions & 3 deletions documentation/storybook.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ argTypes: {

## Best practices for stories

1. Use decorators and / or `args.children` before reaching for `render`. `render` can easily mess up the stories’ code view.
1. Import the Story’s component from the `src` directory so that Storybook can display its types.
Import other components from the package as usual.
2. Use decorators and / or `args.children` before reaching for `render`. `render` can easily mess up the stories’ code view.
Decorators are not shown in the code view, `args.children` are.
2. Always check your stories’ code view.
3. `args.children` can be an array, separated by commas and given ascending numbers as keys.
3. Always check your stories’ code view.
4. `args.children` can be an array, separated by commas and given ascending numbers as keys.

## Future plans

Expand Down
5 changes: 5 additions & 0 deletions packages/css/src/components/breakout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- @license CC0-1.0 -->

# Breakout

A playful composition of visual content breaking out of a Spotlight.
158 changes: 158 additions & 0 deletions packages/css/src/components/breakout/breakout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/**
* @license EUPL-1.2+
* Copyright Gemeente Amsterdam
*/

@import "../../common/breakpoint";
@import "../grid/grid";
@import "../grid/mixins";

$ams-breakout-row-span-max: 4;

.ams-breakout {
@include ams-grid;
}

// Grid gap

.ams-breakout--gap-vertical--none {
@include ams-grid--gap-vertical--none;
}

.ams-breakout--gap-vertical--small {
@include ams-grid--gap-vertical--small;
}

.ams-breakout--gap-vertical--large {
@include ams-grid--gap-vertical--large;
}

// Grid padding

.ams-breakout--padding-bottom--small {
@include ams-grid--padding-bottom--small;
}

.ams-breakout--padding-bottom--medium {
@include ams-grid--padding-bottom--medium;
}

.ams-breakout--padding-bottom--large {
@include ams-grid--padding-bottom--large;
}

.ams-breakout--padding-top--small {
@include ams-grid--padding-top--small;
}

.ams-breakout--padding-top--medium {
@include ams-grid--padding-top--medium;
}

.ams-breakout--padding-top--large {
@include ams-grid--padding-top--large;
}

.ams-breakout--padding-vertical--small {
@include ams-grid--padding-vertical--small;
}

.ams-breakout--padding-vertical--medium {
@include ams-grid--padding-vertical--medium;
}

.ams-breakout--padding-vertical--large {
@include ams-grid--padding-vertical--large;
}

.ams-breakout__cell--col-span-all {
@include ams-grid__cell--span-all;
}

// Column span
// The order of these declaration blocks ensures the intended specificity.

@for $i from 1 through $ams-grid-column-count {
.ams-breakout__cell--col-span-#{$i} {
@include ams-grid__cell--span($i);
}

.ams-breakout__cell--col-start-#{$i} {
@include ams-grid__cell--start($i);
}
}

@media screen and (min-width: $ams-breakpoint-medium) {
@for $i from 1 through $ams-grid-column-count-medium {
.ams-breakout__cell--col-span-#{$i}-medium {
@include ams-grid__cell--span-medium($i);
}

.ams-breakout__cell--col-start-#{$i}-medium {
@include ams-grid__cell--start-medium($i);
}
}
}

@media screen and (min-width: $ams-breakpoint-wide) {
@for $i from 1 through $ams-grid-column-count-wide {
.ams-breakout__cell--col-span-#{$i}-wide {
@include ams-grid__cell--span-wide($i);
}

.ams-breakout__cell--col-start-#{$i}-wide {
@include ams-grid__cell--start-wide($i);
}
}
}

// Row span

@for $i from 1 through $ams-breakout-row-span-max {
.ams-breakout__cell--row-span-#{$i} {
grid-row-end: span $i;
}

.ams-breakout__cell--row-start-#{$i} {
grid-row-start: $i;
}
}

@media screen and (min-width: $ams-breakpoint-medium) {
@for $i from 1 through $ams-breakout-row-span-max {
.ams-breakout__cell--row-span-#{$i}-medium {
grid-row-end: span $i;
}

.ams-breakout__cell--row-start-#{$i}-medium {
grid-row-start: $i;
}
}
}

@media screen and (min-width: $ams-breakpoint-wide) {
@for $i from 1 through $ams-breakout-row-span-max {
.ams-breakout__cell--row-span-#{$i}-wide {
grid-row-end: span $i;
}

.ams-breakout__cell--row-start-#{$i}-wide {
grid-row-start: $i;
}
}
}

// Cover gap

.ams-breakout__cell--cover-gap {
margin-block: calc(var(--ams-space-grid-md) * -1);
margin-inline: calc(var(--ams-space-grid-lg) * -1);

.ams-breakout--gap-vertical--small > & {
margin-block: calc(var(--ams-space-grid-sm) * -1);
}

.ams-breakout--gap-vertical--large > & {
margin-block: calc(var(--ams-space-grid-lg) * -1);
}
}
110 changes: 110 additions & 0 deletions packages/css/src/components/grid/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* @license EUPL-1.2+
* Copyright Gemeente Amsterdam
*/

@mixin ams-grid {
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
column-gap: var(--ams-grid-column-gap);
display: grid;
grid-template-columns: repeat(var(--ams-grid-column-count), 1fr);
padding-inline: var(--ams-grid-padding-inline);
row-gap: var(--ams-grid-row-gap-md);

@media screen and (min-width: $ams-breakpoint-medium) {
grid-template-columns: repeat(var(--ams-grid-medium-column-count), 1fr);
}

@media screen and (min-width: $ams-breakpoint-wide) {
grid-template-columns: repeat(var(--ams-grid-wide-column-count), 1fr);
}
}

// Grid gap

@mixin ams-grid--gap-vertical--none {
row-gap: initial;
}

@mixin ams-grid--gap-vertical--small {
row-gap: var(--ams-grid-row-gap-sm);
}

@mixin ams-grid--gap-vertical--large {
row-gap: var(--ams-grid-row-gap-lg);
}

// Grid padding

@mixin ams-grid--padding-bottom--small {
padding-block-end: var(--ams-grid-padding-block-sm);
}

@mixin ams-grid--padding-bottom--medium {
padding-block-end: var(--ams-grid-padding-block-md);
}

@mixin ams-grid--padding-bottom--large {
padding-block-end: var(--ams-grid-padding-block-lg);
}

@mixin ams-grid--padding-top--small {
padding-block-start: var(--ams-grid-padding-block-sm);
}

@mixin ams-grid--padding-top--medium {
padding-block-start: var(--ams-grid-padding-block-md);
}

@mixin ams-grid--padding-top--large {
padding-block-start: var(--ams-grid-padding-block-lg);
}

@mixin ams-grid--padding-vertical--small {
padding-block: var(--ams-grid-padding-block-sm);
}

@mixin ams-grid--padding-vertical--medium {
padding-block: var(--ams-grid-padding-block-md);
}

@mixin ams-grid--padding-vertical--large {
padding-block: var(--ams-grid-padding-block-lg);
}

@mixin ams-grid__cell--span-all {
grid-column: 1 / -1;
}

// Column span

@mixin ams-grid__cell--span($i) {
grid-column-end: span $i;
}

@mixin ams-grid__cell--start($i) {
grid-column-start: $i;
}

@mixin ams-grid__cell--span-medium($i) {
@media screen and (min-width: $ams-breakpoint-medium) {
grid-column-end: span $i;
}
}

@mixin ams-grid__cell--start-medium($i) {
@media screen and (min-width: $ams-breakpoint-medium) {
grid-column-start: $i;
}
}

@mixin ams-grid__cell--span-wide($i) {
@media screen and (min-width: $ams-breakpoint-wide) {
grid-column-end: span $i;
}
}

@mixin ams-grid__cell--start-wide($i) {
@media screen and (min-width: $ams-breakpoint-wide) {
grid-column-start: $i;
}
}
Loading