Skip to content

Commit

Permalink
Add uniboard fallback for browsers without min()/max() support
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktwerner committed May 13, 2023
1 parent c8a7b50 commit 3449d03
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ui/analyse/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ body {
'uchat';

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-width var(--gauge-gap) $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width var(--gauge-gap) $col2-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas:
Expand Down Expand Up @@ -111,6 +112,7 @@ body {
}

@include breakpoint($mq-col3) {
grid-template-columns: $col3-uniboard-side $block-gap $col3-uniboard-fallback-width var(--gauge-gap) $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $block-gap $col3-uniboard-width var(--gauge-gap) $col3-uniboard-table;
grid-template-rows: $meta-height $chat-height 2.5em 1fr;
grid-template-areas:
Expand Down
16 changes: 16 additions & 0 deletions ui/common/css/abstract/_uniboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,19 @@ $col2-uniboard-squeeze-table: minmax(200px, 240px);
$col2-uniboard-squeeze-width: minmax(calc(55vmin), calc(100vh - #{$site-header-outer-height} - #{$block-gap}));

$col1-uniboard-controls: 5rem;

// fallbacks for really old browsers that don't support css min() and max() functions
$col3-uniboard-fallback-min-width: calc(70vmin * var(--board-scale));
$col3-uniboard-fallback-max-width: calc(
100vh * var(--board-scale) - #{$site-header-outer-height} - #{$col3-uniboard-controls}
);
$col3-uniboard-fallback-width: minmax($col3-uniboard-fallback-min-width, $col3-uniboard-fallback-max-width);
$col3-uniboard-fallback-default-max-width: calc(
100vh * #{$uniboard-default-scale} - #{$site-header-outer-height} - #{$col3-uniboard-controls}
);
$col3-uniboard-fallback-default-width: minmax(
#{$col3-uniboard-default-min-width},
#{$col3-uniboard-fallback-default-max-width}
);
$col2-uniboard-fallback-width: $col3-uniboard-fallback-width;
$col2-uniboard-fallback-default-width: $col3-uniboard-fallback-default-width;
2 changes: 2 additions & 0 deletions ui/coordinateTrainer/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ $mq-col3: $mq-x-large;
grid-row-gap: $block-gap;

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-width $block-gap $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width $block-gap $col2-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas:
Expand All @@ -60,6 +61,7 @@ $mq-col3: $mq-x-large;
'side . progress . .'
'side . co-input . .'
'side . . . .';
grid-template-columns: $col3-uniboard-side $block-gap $col3-uniboard-fallback-width $block-gap $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $block-gap $col3-uniboard-width $block-gap $col3-uniboard-table;
}
}
Expand Down
2 changes: 2 additions & 0 deletions ui/learn/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ $mq-col3: $mq-col3-uniboard;

@include breakpoint($mq-col2) {
&--run {
grid-template-columns: $col2-uniboard-fallback-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width $col2-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas: 'main table' 'side .';
Expand All @@ -54,6 +55,7 @@ $mq-col3: $mq-col3-uniboard;

@include breakpoint($mq-col3) {
&--run {
grid-template-columns: $col3-uniboard-side $col3-uniboard-fallback-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $col3-uniboard-width $col3-uniboard-table;
grid-template-areas: 'side main table';
}
Expand Down
2 changes: 2 additions & 0 deletions ui/puzzle/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
}

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-width var(--gauge-gap) $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width var(--gauge-gap) $col2-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas:
Expand All @@ -81,6 +82,7 @@
'side . session . controls'
'side . kb-move . controls'
'side . . . .';
grid-template-columns: $col3-uniboard-side $block-gap $col3-uniboard-fallback-width var(--gauge-gap) $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $block-gap $col3-uniboard-width var(--gauge-gap) $col3-uniboard-table;
}

Expand Down
1 change: 1 addition & 0 deletions ui/racer/css/_racer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
grid-template-areas: 'board' 'race' 'side' 'history';

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width $col2-uniboard-table;
grid-template-rows: auto fit-content(0);
grid-template-areas:
Expand Down
2 changes: 2 additions & 0 deletions ui/round/css/_app-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

@include breakpoint($mq-col2) {
grid-template-areas: 'board voice' 'board .' 'board mat-top' 'board clock-top' 'board expi-top' 'board user-top' 'board moves' 'board controls' 'board user-bot' 'board expi-bot' 'board clock-bot' 'board mat-bot' 'board .' 'kb-move .';
grid-template-columns: $col2-uniboard-fallback-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width $col2-uniboard-table;
grid-template-rows: 0; // prevent voice from pushing the table off center
grid-column-gap: $block-gap;
Expand Down Expand Up @@ -116,6 +117,7 @@
}

@include breakpoint($mq-col3) {
grid-template-columns: $col3-uniboard-fallback-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-width $col3-uniboard-table;
}

Expand Down
1 change: 1 addition & 0 deletions ui/round/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
}

@include breakpoint($mq-col3) {
grid-template-columns: $col3-uniboard-side $col3-uniboard-fallback-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $col3-uniboard-width $col3-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas: 'side app app' 'uchat under .';
Expand Down
2 changes: 2 additions & 0 deletions ui/simul/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

@include breakpoint($mq-col2) {
&:not(.simul-created) {
grid-template-columns: $col2-uniboard-fallback-default-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-default-width $col2-uniboard-table;
grid-template-rows: auto max-content;
grid-template-areas: 'main side' 'main uchat' '. uchat';
Expand All @@ -26,6 +27,7 @@

@include breakpoint($mq-col3) {
&.simul {
grid-template-columns: $col3-uniboard-side $col3-uniboard-fallback-default-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $col3-uniboard-default-width $col3-uniboard-table;
grid-template-rows: auto fit-content(0);
grid-template-areas: 'side main main' 'uchat main main' 'uchat . .';
Expand Down
1 change: 1 addition & 0 deletions ui/site/css/tv/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $mq-col3: $mq-col3-uniboard;
}

@include breakpoint($mq-col3) {
grid-template-columns: $col3-uniboard-side $col3-uniboard-fallback-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $col3-uniboard-width $col3-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas: 'side app app' 'side under .';
Expand Down
1 change: 1 addition & 0 deletions ui/storm/css/_play.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
grid-template-areas: 'board' 'side';

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-width $col2-uniboard-table;
grid-template-rows: fit-content(0);
grid-template-areas: 'board side';
Expand Down
2 changes: 2 additions & 0 deletions ui/swiss/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $chat-optimal-size: calc(100vh - #{$site-header-outer-height} - #{$block-gap} -
grid-gap: $block-gap;

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-default-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-default-width $col2-uniboard-table;
grid-template-rows: $chat-optimal-size min-content;
grid-template-areas: 'main side' 'main uchat' 'table table';
Expand All @@ -43,6 +44,7 @@ $chat-optimal-size: calc(100vh - #{$site-header-outer-height} - #{$block-gap} -
}

@include breakpoint($mq-col3) {
grid-template-columns: $col3-uniboard-side $col3-uniboard-fallback-default-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $col3-uniboard-default-width $col3-uniboard-table;
grid-template-rows: $chat-optimal-size auto;
grid-template-areas: 'side main table' 'uchat main table';
Expand Down
2 changes: 2 additions & 0 deletions ui/tournament/css/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $chat-optimal-size: calc(100vh - #{$site-header-outer-height} - #{$block-gap} -
grid-gap: $block-gap;

@include breakpoint($mq-col2) {
grid-template-columns: $col2-uniboard-fallback-default-width $col2-uniboard-table;
grid-template-columns: $col2-uniboard-default-width $col2-uniboard-table;
grid-template-rows: $chat-optimal-size min-content;
grid-template-areas: 'main side' 'main uchat' 'table table';
Expand All @@ -49,6 +50,7 @@ $chat-optimal-size: calc(100vh - #{$site-header-outer-height} - #{$block-gap} -
}

@include breakpoint($mq-col3) {
grid-template-columns: $col3-uniboard-side $col3-uniboard-fallback-default-width $col3-uniboard-table;
grid-template-columns: $col3-uniboard-side $col3-uniboard-default-width $col3-uniboard-table;
grid-template-rows: $chat-optimal-size auto;
grid-template-areas: 'side main table' 'uchat main table';
Expand Down

0 comments on commit 3449d03

Please sign in to comment.