Skip to content

Commit 4f6e27a

Browse files
Copilotrenemadsen
andcommitted
Refactor SCSS files with improved structure, documentation, and M3 best practices
Co-authored-by: renemadsen <[email protected]>
1 parent 399586e commit 4f6e27a

File tree

11 files changed

+640
-226
lines changed

11 files changed

+640
-226
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
1+
/**
2+
* Card Component Styles
3+
*
4+
* Provides utility classes for customizing card header and body spacing.
5+
* These classes allow for flexible card layouts with different padding configurations.
6+
*/
7+
8+
/**
9+
* Card Header Variants
10+
*/
11+
12+
// Extended header with less vertical padding
113
.card-header-extended {
214
padding: 0.3rem 1.7rem;
315
}
416

17+
// Simple header with standard padding
518
.card-header-simple {
619
padding: 1.2rem 1.7rem;
720
}
821

22+
/**
23+
* Card Body Variants
24+
*/
25+
26+
// Minimal spacing for card body
927
.card-body-no-spaces {
1028
padding: 0.2rem 1rem;
1129
}

eform-client/src/scss/components/_chart.scss

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,46 @@
1+
/**
2+
* Chart Component Styles
3+
*
4+
* Provides theming for ngx-charts components with support for light and dark themes.
5+
* Customizes chart appearance including text, backgrounds, tooltips, and legends.
6+
*/
7+
18
@use 'sass:map';
29
@use '@angular/material' as mat;
310

11+
/**
12+
* Color Mixin
13+
*
14+
* Applies theme-aware styling to chart components.
15+
* Provides comprehensive dark theme support with carefully chosen colors.
16+
*
17+
* @param {Map} $theme - The Material theme map
18+
*/
419
@mixin color($theme) {
520
$color-config: mat.m2-get-color-config($theme);
621
$is-dark-theme: map.get($color-config, 'is-dark');
722
$background: map.get(map.get($theme, 'background'), 'card');
823

924
@if ($is-dark-theme) {
10-
/*Backgrounds*/
25+
// Dark theme color palette
1126
$color-bg-darkest: #13141b;
1227
$color-bg-darker: #1b1e27;
1328
$color-bg-dark: #232837;
1429
$color-bg-med: #2f3646;
1530
$color-bg-light: #455066;
1631
$color-bg-lighter: #5b6882;
1732

18-
/*Text*/
33+
// Dark theme text colors
1934
$color-text-dark: #72809b;
2035
$color-text-med-dark: #919db5;
21-
$color-text-med: #A0AABE;
36+
$color-text-med: #a0aabe;
2237
$color-text-med-light: #d9dce1;
2338
$color-text-light: #f0f1f6;
2439
$color-text-lighter: #fff;
2540

2641
background: $color-bg-darker;
2742

43+
// Base chart text styling
2844
.ngx-charts {
2945
text {
3046
fill: $color-text-med;
@@ -46,6 +62,7 @@
4662
fill: #fff;
4763
}
4864

65+
// Grid panel styling
4966
.grid-panel {
5067
&.odd {
5168
rect {
@@ -54,18 +71,21 @@
5471
}
5572
}
5673

74+
// Force-directed graph styling
5775
.force-directed-graph {
5876
.edge {
5977
stroke: $color-bg-light;
6078
}
6179
}
6280

81+
// Number card styling
6382
.number-card {
6483
p {
6584
color: $color-text-light;
6685
}
6786
}
6887

88+
// Gauge chart styling
6989
.gauge {
7090
.background-arc {
7191
path {
@@ -84,6 +104,7 @@
84104
}
85105
}
86106

107+
// Linear gauge styling
87108
.linear-gauge {
88109
.background-bar {
89110
path {
@@ -96,6 +117,7 @@
96117
}
97118
}
98119

120+
// Timeline styling
99121
.timeline {
100122
.brush-background {
101123
fill: rgba(255, 255, 255, 0.05);
@@ -109,11 +131,13 @@
109131
}
110132
}
111133

134+
// Polar chart styling
112135
.polar-chart .polar-chart-background {
113136
fill: rgb(30, 34, 46);
114137
}
115138
}
116139

140+
// Chart legend styling for dark theme
117141
.chart-legend {
118142
.legend-labels {
119143
background: $background !important;
@@ -144,6 +168,7 @@
144168
}
145169
}
146170

171+
// Advanced pie legend styling for dark theme
147172
.advanced-pie-legend {
148173
color: $color-text-med;
149174

@@ -164,24 +189,38 @@
164189
font-size: 0.8em;
165190
color: $color-text-med;
166191
}
167-
} @else { // light theme
192+
} @else {
193+
// Light theme legend styling
168194
.advanced-pie-legend {
169195
.legend-items-container {
170196
.legend-items {
171197
overflow: visible !important;
172198
}
173199
}
174200
}
175-
}
201+
}
176202
}
177203

204+
/**
205+
* Main Theme Mixin
206+
*
207+
* Entry point for applying theme-specific chart styles.
208+
*
209+
* @param {Map} $theme - The Material theme map
210+
*/
178211
@mixin theme($theme) {
179212
$color-config: mat.m2-get-color-config($theme);
213+
180214
@if $color-config != null {
181215
@include color($theme);
182216
}
183217
}
184218

219+
/**
220+
* Common Chart Styles
221+
*
222+
* Styles applied regardless of theme.
223+
*/
185224
.legend-title-text {
186225
text-overflow: clip !important;
187226
padding-right: 5px;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1+
/**
2+
* Form Component Styles
3+
*
4+
* Provides utility classes for Material Design form fields with various spacing options.
5+
* These classes enable flexible form layouts and consistent spacing across the application.
6+
*/
7+
8+
/**
9+
* Material Design Form Variants
10+
*/
11+
12+
// Form field for case elements with minimal spacing
113
.md-form {
214
&.md-form-case-elem {
315
margin-top: 0.3rem;
416
margin-bottom: 0;
517
}
18+
19+
// Form field with no spacing
620
&.md-form-no-spacing {
721
margin: 0 !important;
822
padding: 0 !important;
923
}
24+
25+
// Small form field with standard margin
1026
&.md-form-sm {
1127
margin: 1rem !important;
1228
padding: 0 !important;
1329
}
1430
}
1531

32+
/**
33+
* Material Form Field Base Styles
34+
*/
1635
.mat-mdc-form-field {
1736
width: 100%;
1837
}
Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
1+
/**
2+
* Component Styles Index
3+
*
4+
* Central import point for all component-specific styles.
5+
* This file organizes component styles in a logical order and makes them
6+
* available throughout the application.
7+
*
8+
* Organization:
9+
* - Interactive components (buttons, checkboxes, dropdowns)
10+
* - Layout components (cards, modals, tables)
11+
* - Content components (text, icons, charts)
12+
* - UI feedback components (spinners, progress bars, tooltips, tags)
13+
*
14+
* Note: Order matters for cascade and specificity rules.
15+
*/
16+
17+
// Interactive Components
118
@use 'button';
2-
@use 'material-dropdown';
3-
@use 'text';
419
@use 'checkbox';
5-
@use 'icon';
6-
@use 'spinner';
7-
@use 'progress-bar';
8-
@use 'table';
920
@use 'checkbox-material';
21+
@use 'material-dropdown';
22+
23+
// Layout Components
1024
@use 'card';
1125
@use 'form';
1226
@use 'modal';
27+
@use 'table';
28+
29+
// Content Components
30+
@use 'text';
31+
@use 'icon';
1332
@use 'chart';
14-
@use "tooltip";
15-
@use "tag";
33+
34+
// UI Feedback Components
35+
@use 'spinner';
36+
@use 'progress-bar';
37+
@use 'tooltip';
38+
@use 'tag';

eform-client/src/scss/components/_modal.scss

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,50 @@
1-
// Modal y fix
1+
/**
2+
* Modal Component Styles
3+
*
4+
* Customizes modal behavior and appearance with theme support.
5+
* Handles scrolling behavior and dark theme styling for modal components.
6+
*/
7+
8+
/**
9+
* Modal Scrolling Behavior
10+
*
11+
* Ensures modals are scrollable without showing scrollbars.
12+
* Provides a cleaner appearance across different browsers.
13+
*/
214
.modal-open .modal {
315
overflow-y: auto;
4-
-ms-overflow-style: none; // IE 10+
5-
overflow: -moz-scrollbars-none; // Firefox
16+
-ms-overflow-style: none; // IE 10+
17+
overflow: -moz-scrollbars-none; // Firefox
18+
619
&::-webkit-scrollbar {
7-
display: none; // Safari and Chrome
20+
display: none; // Safari and Chrome
821
}
922
}
1023

24+
/**
25+
* Dark Theme Modal Styles
26+
*
27+
* Applies dark theme colors to modal header, body, and footer.
28+
* Ensures proper contrast and readability in dark mode.
29+
*/
1130
body.theme-dark {
1231
.modal-content {
1332
background-color: var(--theme-background-color);
33+
1434
.modal-header {
1535
background-color: var(--black-075);
1636
color: var(--theme-body-font-color);
1737
border-bottom: 1px solid var(--black-300);
38+
1839
button.close {
1940
color: var(--black-900);
2041
}
2142
}
43+
2244
.modal-body {
2345
color: var(--theme-body-font-color);
2446
}
47+
2548
.modal-footer {
2649
border-top: 1px solid var(--black-300);
2750
}

0 commit comments

Comments
 (0)