Skip to content

Commit 615548d

Browse files
committed
+ add flex-container mixin
+ use it on code examples + version inc
1 parent ed0a632 commit 615548d

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cardholder-pwa",
3-
"version": "0.0.11",
3+
"version": "0.0.12",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve --port=4207 --open",

frontend/src/app/features/code-examples/code-examples.component.scss

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1+
@use 'mixins' as mx;
2+
13
:host {
24
.code-examples {
3-
width: 100%;
4-
height: auto;
5-
max-height: 100%;
6-
display: flex;
7-
flex-direction: row;
8-
align-items: stretch;
9-
justify-content: flex-start;
10-
flex-wrap: wrap;
11-
overflow: hidden;
12-
gap: 16px;
13-
14-
& > * {
15-
width: 100%;
16-
}
17-
18-
@media (width > 400px) {
19-
& > * {
20-
width: calc(50% - 8px);
21-
}
22-
}
5+
@include mx.flex-container(6);
236

247
.code-examples-item {
258
margin: 0;

frontend/src/mixins.scss

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
width: 100%;
1616
max-width: 600px;
1717
}
18+
// Mixin for password hints list
1819
@mixin form-password-hints {
1920
padding-left: 20px;
2021
margin: unset;
2122
width: 100%;
2223
padding-bottom: 20px;
2324
}
25+
// Mixin for main components e.g. cards, user
26+
// presented in main router-outlet.
2427
@mixin component-host {
2528
display: block;
2629
padding: 16px 16px 40px 16px;
@@ -29,6 +32,7 @@
2932
max-height: 100%;
3033
position: relative;
3134
}
35+
// Mixin ofr tables in admin component
3236
@mixin mat-table {
3337
table {
3438
width: 100%;
@@ -43,7 +47,38 @@
4347
}
4448
}
4549
}
50+
// Mixin for buttons in mat-dialog
4651
@mixin mat-dialog-actions {
4752
margin-top: auto;
4853
gap: 8px;
4954
}
55+
// Mixin for flexible containers e.g. forms, card, code-examples.
56+
@mixin flex-container($maxCols: 4) {
57+
width: 100%;
58+
height: auto;
59+
max-height: 100%;
60+
display: flex;
61+
flex-direction: row;
62+
align-items: stretch;
63+
justify-content: flex-start;
64+
flex-wrap: wrap;
65+
overflow: hidden;
66+
67+
$gap: 16px;
68+
gap: $gap;
69+
70+
& > * {
71+
width: 100%;
72+
}
73+
74+
@for $i from 1 through $maxCols - 1 {
75+
$cols: $i + 1;
76+
$breakpoint: 400px + 300px * $i;
77+
78+
@media (width > $breakpoint) {
79+
& > * {
80+
width: calc(100% / #{$cols} - $gap * $i / $cols);
81+
}
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)