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

[FEATURE] Kuwait Theme: Radio group styling #2737

Merged
merged 20 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c665722
support added for flex `radio-buttons`
FaithDaka Jan 21, 2025
0a2155b
flex button styling
FaithDaka Jan 21, 2025
3c8a558
Merge branch 'master' of https://github.com/IDEMSInternational/open-a…
FaithDaka Jan 22, 2025
0ecbab2
naming refactor
FaithDaka Jan 22, 2025
a83c771
radio-buttons styling
FaithDaka Jan 22, 2025
a7e1436
Merge branch 'master' into bug-kw-radio-group-styling
jfmcquade Jan 23, 2025
1e1b2a3
Merge branch 'master' into bug-kw-radio-group-styling
esmeetewinkel Jan 28, 2025
3ab5349
Merge branch 'master' into bug-kw-radio-group-styling
jfmcquade Jan 30, 2025
bce0b52
Merge branch 'master' of https://github.com/IDEMSInternational/open-a…
FaithDaka Feb 4, 2025
5f0eeb7
refactor: use scss variables
FaithDaka Feb 4, 2025
dc3a50b
Merge branch 'master' into bug-kw-radio-group-styling
esmeetewinkel Feb 18, 2025
d086482
Merge branch 'master' into bug-kw-radio-group-styling
jfmcquade Feb 18, 2025
d819ef7
Merge branch 'bug-kw-radio-group-styling' of https://github.com/IDEMS…
jfmcquade Feb 18, 2025
8862301
Merge branch 'bug-kw-radio-group-styling' of https://github.com/IDEMS…
jfmcquade Feb 18, 2025
84798b1
chore: refactor radio group flex styling to be defined at comopnent a…
jfmcquade Feb 18, 2025
37f81cb
chore: expose grid_gap and item_width params to flex variant
jfmcquade Feb 18, 2025
0710bc5
chore: add 'secondary' style for radio button grid component; expose …
jfmcquade Feb 19, 2025
89c2687
chore: flex configuration
jfmcquade Feb 19, 2025
0901aa2
chore: fix min width and height
jfmcquade Feb 19, 2025
4a63a85
Merge branch 'master' into bug-kw-radio-group-styling
jfmcquade Feb 19, 2025
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
<div class="radio-grid" [ngStyle]="gridStyle" [attr.data-variant]="parameter_list.variant">
<div
class="radio-buttons"
[ngStyle]="gridStyle"
[attr.data-variant]="parameter_list.variant"
[attr.data-style]="parameter_list.style"
>
@for (item of radioItems; track $index) {
<div
class="item"
(click)="handleItemClick(item)"
[attr.data-selected]="item.name === _row.value"
[style.--min-item-width]="parameter_list.item_width"
>
@if (item.image) {
<div class="item-image-container">
Expand All @@ -17,7 +23,9 @@
</div>
}
@if (item.text) {
<div class="item-text">{{ item.text }}</div>
<div class="item-text">
<p>{{ item.text }}</p>
</div>
}
</div>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,60 @@
// @use "/src/theme/mixins";

// Vars for primary style
$background: var(--radio-group-background, white);
$background-selected: var(
--radio-group-background-selected,
var(--gradient-primary-light-vertical)
);
$border: var(--border-standard);
$border-radius: var(--ion-border-radius-standard);
$border: var(--radio-group-border, var(--border-standard));
$border-selected: var(--radio-group-border-selected, var(--border-standard));

// Vars for secondary style
$background-secondary: var(--radio-group-background-secondary, white);
$background-selected-secondary: var(
--radio-group-background-selected-secondary,
var(--gradient-secondary-light-vertical)
);
$border-secondary: var(--radio-group-border-secondary, var(--border-standard));
$border-selected-secondary: var(--radio-group-border-selected-secondary, var(--border-standard));

$border-radius: var(--radio-group-border-radius, var(--ion-border-radius-standard));
$box-shadow: var(--radio-group-box-shadow, var(--ion-default-box-shadow));
$text-size: var(--radio-button-font-size, 1.25rem);
$text-color: var(--radio-button-font-color, var(--ion-color-primary));

.radio-grid {
.radio-buttons {
display: grid;
}
.item {
border: $border;
border-radius: 15px;
text-align: center;
padding: 8px;
background: white;
cursor: pointer;
box-shadow: var(--ion-default-box-shadow);
}
.item[data-selected="true"] {
background: $background-selected;
}
.item-text {
font-size: $text-size;
color: $text-color;
.item {
border: $border;
border-radius: $border-radius;
text-align: center;
padding: 8px;
background: $background;
cursor: pointer;
box-shadow: $box-shadow;
&[data-selected="true"] {
background: $background-selected;
border: $border-selected;
transition: 0.2s linear;
}
.item-text {
font-size: $text-size;
color: $text-color;
}
}

&[data-style="secondary"] {
.item {
border: $border-secondary;
background: $background-secondary;
&[data-selected="true"] {
background: $background-selected-secondary;
border: $border-selected-secondary;
}
}
}
}

.radio-grid[data-variant="circle-icon"] {
.radio-buttons[data-variant="circle-icon"] {
display: grid;

.item {
Expand Down Expand Up @@ -77,3 +102,54 @@ $text-color: var(--radio-button-font-color, var(--ion-color-primary));
}
}
}

.radio-buttons[data-variant="flex"] {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
width: 100%;
.item {
flex: 1 1 auto;
width: 25%;
min-width: var(--min-item-width, 10px);
background-color: $background;
box-shadow: $box-shadow;
border: $border;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
gap: 12px;
padding: 12px 8px;

&[data-selected="true"] {
background-color: $background-selected;
border: $border-selected;
}
.item-image-container {
height: var(--icon-size-largest);
img {
height: 100%;
}
}
.item-text {
p {
font-size: var(--font-size-text-small);
text-align: center;
margin: 0px;
}
}
}

&[data-style="secondary"] {
.item {
border: $border-secondary;
background: $background-secondary;
&[data-selected="true"] {
background: $background-selected-secondary;
border: $border-selected-secondary;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ interface IRadioButtonGridParams {
**/
grid_gap: string;
/* TEMPLATE PARAMETER: "variant". The style variant of the button_grid */
variant?: "default" | "circle-icon";
variant?: "default" | "circle-icon" | "flex";
/* TEMPLATE PARAMETER: "style". The "secondary" style sets the colour of the buttons */
style?: "secondary" | undefined;
}

@Component({
Expand Down Expand Up @@ -73,6 +75,11 @@ export class TmplRadioButtonGridComponent
this.parameter_list = this._row.parameter_list || ({} as any);
this.radioItems = getAnswerListParamFromTemplateRow(this._row, "answer_list", []);
this.gridStyle = this.generateGridStyle();
this.parameter_list.style = getStringParamFromTemplateRow(
this._row,
"style",
undefined
) as IRadioButtonGridParams["style"];
this.parameter_list.variant = getStringParamFromTemplateRow(this._row, "variant", "default")
.split(",")
.join(" ") as IRadioButtonGridParams["variant"];
Expand Down
2 changes: 2 additions & 0 deletions src/theme/themes/early_family_math.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
// slider-ui-color: #096e90,
accordion-background-highlight: var(--ion-color-primary-300),
tour-next-button-background: var(--ion-color-secondary),
radio-button-font-color: var(--ion-color-primary-900),
radio-group-background-selected: var(--ion-color-primary-300),
radio-group-background-selected-secondary: var(--ion-color-secondary-200),
// radio-button-font-size: 1.25rem,
// radio-button-font-color: var(--ion-color-primary),
ion-item-background: var(--ion-color-gray-light),
Expand Down
1 change: 1 addition & 0 deletions src/theme/themes/pfr.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
accordion-background-highlight: var(--ion-color-primary-300),
tour-next-button-background: var(--ion-color-secondary),
radio-group-background-selected: var(--ion-color-primary-300),
radio-group-background-selected-secondary: var(--ion-color-secondary-300),
// radio-button-font-size: 1.25rem,
// radio-button-font-color: var(--ion-color-primary),
ion-item-background: var(--ion-color-gray-light),
Expand Down
1 change: 1 addition & 0 deletions src/theme/themes/plh_facilitator_mx/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
accordion-background-highlight: var(--ion-color-primary-300),
tour-next-button-background: var(--ion-color-secondary),
radio-group-background-selected: var(--ion-color-primary-300),
radio-group-background-selected-secondary: var(--ion-color-secondary-300),
ion-item-background: var(--ion-color-gray-light),
task-progress-bar-color: var(--ion-color-green),
progress-path-line-background: var(--ion-color-gray-100),
Expand Down
39 changes: 24 additions & 15 deletions src/theme/themes/plh_kids_kw/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@
line-height-text-large: 32px,
line-height-text-extra-large: 40px,

ion-border-radius-small: 8px,
ion-border-radius-standard: 12px,
ion-border-radius-secondary: 20px,
ion-border-radius-rounded: 50px,
icon-size-small: 16px,
icon-size-medium: 24px,
icon-size-large: 32px,
icon-size-extra-large: 40px,
icon-size-largest: 48px,

paragraph-margin-small: 4px,
paragraph-margin-medium: 8px,
paragraph-margin-large: 12px,

buttons-min-height: 60px,
buttons-short-height: 48px,
Expand All @@ -52,10 +57,16 @@
buttons-full-height: 100%,

// BORDERS
ion-border-radius-small: 8px,
ion-border-radius-standard: 12px,
ion-border-radius-secondary: 20px,
ion-border-radius-rounded: 50px,

border-color-default: var(--ion-color-gray-200),
border-width-default: 1px,
border-standard: var(--border-width-default) solid var(--border-color-default),
border-thin-standard: 1px solid var(--border-color-default),
// COMPONENT VARIABLES
button-background-primary: var(--ion-color-primary-500),
button-background-secondary: var(--ion-color-secondary),
button-background-option: var(--ion-color-primary-800),
Expand All @@ -75,20 +86,18 @@
combo-box-background-with-value: var(--ion-color-primary-300),
accordion-background-highlight: var(--ion-color-primary-300),
tour-next-button-background: var(--ion-color-secondary),
radio-group-background-selected: var(--ion-color-primary-300),
ion-item-background: var(--ion-color-gray-light),
task-progress-bar-color: var(--ion-color-green),
progress-path-line-background: var(--ion-color-gray-100),
icon-size-small: 16px,
icon-size-medium: 24px,
icon-size-large: 32px,
icon-size-extra-large: 40px,
icon-size-largest: 48px,

paragraph-margin-small: 4px,
paragraph-margin-medium: 8px,
paragraph-margin-large: 12px,

radio-group-border-radius: var(--ion-border-radius-small),
radio-group-box-shadow: none,
radio-group-border: 1px solid var(--ion-color-gray-100),
radio-group-border-selected: 1px solid var(--ion-color-primary-400),
radio-group-border-secondary: 2px solid transparent,
radio-group-border-selected-secondary: 2px solid var(--color-accent-orange-70),
radio-group-background-secondary: var(--color-accent-orange-90),
radio-group-background-selected: var(--ion-color-primary-300),
radio-group-background-selected-secondary: var(--color-accent-orange-80),
// SURFACE COLOUR PALETTE
color-surface-white: #ffffff,
color-surface-white-variant: #f9f9fa,
Expand Down
11 changes: 0 additions & 11 deletions src/theme/themes/plh_kids_kw/_overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1073,17 +1073,6 @@ body[data-theme="plh_kids_kw"] {
}
}
}
// Radio Button Grid
.radio-grid {
.item {
border: 1px solid var(--ion-color-gray-100);
box-shadow: none !important;
border-radius: var(--ion-border-radius-small);
.item-image-container {
padding: 16px;
}
}
}

// Completion Modal
plh-completion-modal {
Expand Down
1 change: 1 addition & 0 deletions src/theme/themes/plh_kids_tz.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
accordion-background-highlight: var(--ion-color-primary-300),
tour-next-button-background: var(--ion-color-secondary),
radio-group-background-selected: var(--ion-color-primary-300),
radio-group-background-selected-secondary: var(--ion-color-secondary-300),
// radio-button-font-size: 1.25rem,
// radio-button-font-color: var(--ion-color-primary),
ion-item-background: var(--ion-color-gray-light),
Expand Down
1 change: 1 addition & 0 deletions src/theme/themes/professional.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
accordion-background-highlight: var(--ion-color-primary-300),
tour-next-button-background: var(--ion-color-secondary),
radio-group-background-selected: var(--ion-color-primary-300),
radio-group-background-selected-secondary: var(--ion-color-secondary-300),
// radio-button-font-size: 1.25rem,
// radio-button-font-color: var(--ion-color-primary),
ion-item-background: var(--ion-color-gray-light),
Expand Down
Loading