File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed
Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @cloudfour/patterns " : minor
3+ ---
4+
5+ Add Block Size Utilities: Adds "full" and "auto" size utility classes for the ` block ` direction.
Original file line number Diff line number Diff line change 1+ <div class =" demo-u-size-block" >
2+ <div style =" height:150px;" >
3+ <div class =" u-size-block-full u-pad-n1 u-rounded t-dark t-alternate u-text-center" >
4+ full (in a 150px tall container)
5+ </div >
6+ </div >
7+ <div style =" height:150px;" >
8+ <div class =" u-size-block-auto u-pad-n1 u-rounded t-dark t-alternate u-text-center" >
9+ auto (in a 150px tall container)
10+ </div >
11+ </div >
12+ </div >
Original file line number Diff line number Diff line change 88 }
99}
1010
11+ .demo-u-size-block {
12+ display : flex ;
13+ flex-direction : column ;
14+ gap : 1em ;
15+ }
16+
1117.demo-u-size-responsive {
1218 display : flex ;
1319 gap : 1em ;
Original file line number Diff line number Diff line change 2121 }
2222}
2323
24+ // Set the block size styles in a mixin. The suffix will let us easily append
25+ // breakpoint suffixes.
26+ @mixin _block-size-utilities ($suffix : ' ' ) {
27+ .u-size-block-full#{$suffix } {
28+ block-size : 100% !important ;
29+ }
30+
31+ .u-size-block-auto#{$suffix } {
32+ block-size : auto !important ;
33+ }
34+ }
35+
2436// Include the default versions (no media queries)
2537@include _inline-size-utilities ;
38+ @include _block-size-utilities ;
2639
2740// Include responsive versions. This would be simpler if we could use the
2841// `breakpoint-classes` mixin instead, but in this case we want all of the
3144@include media-query .breakpoint-loop using ($key ) {
3245 $suffix : \@#{$key } ;
3346 @include _inline-size-utilities ($suffix );
47+ @include _block-size-utilities ($suffix );
3448}
Original file line number Diff line number Diff line change 11import { Canvas , Meta , Story } from ' @storybook/addon-docs' ;
22import inlineSizeDemo from ' ./demo/inline-size.twig' ;
3+ import blockSizeDemo from ' ./demo/block-size.twig' ;
34import responsiveDemo from ' ./demo/responsive.twig' ;
45import ' ./demo/styles.scss' ;
56
@@ -34,6 +35,17 @@ Utilities beginning with `u-size-inline-` specify the `inline-size` of an elemen
3435 <Story name = " Inline size (Width)" >{ () => inlineSizeDemo ()} </Story >
3536</Canvas >
3637
38+ ## Block size
39+
40+ Utilities beginning with ` u-size-block- ` specify the ` block-size ` of an element:
41+
42+ - ` u-size-block-full ` sets the ` block-size ` to ` 100% ` of the container.
43+ - ` u-size-block-auto ` sets the ` block-size ` to the natural value for the element.
44+
45+ <Canvas >
46+ <Story name = " Block size (Height)" >{ () => blockSizeDemo ()} </Story >
47+ </Canvas >
48+
3749## Responsive
3850
3951All of these utilities include responsive variations. Appending ` @{breakpoint} ` to the end of the class name will cause the utility to change for the given breakpoint.
You can’t perform that action at this time.
0 commit comments