Skip to content

Commit

Permalink
feat(QUV-2366): icon variables and mixins styles improvements (#6)
Browse files Browse the repository at this point in the history
* QUV-2366: Utils vs Base order in mixins and functions

* QUV-2366: icon-status mixin created

* QUV-2366: icon font family variables have been moved to icons variables. fonts variables have been removed.

* QUV-2366: icon-font mixin from genesys-icon

* QUV-2366: icon variables change

* QUV-2366: Genesys base styles update
  • Loading branch information
jguede authored Jun 28, 2024
1 parent b676049 commit a001554
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 58 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"ts-node": "^10.9.2"
},
"peerDependencies": {
"@devoinc/genesys-base-styles": "^2.0.0",
"@devoinc/genesys-base-styles": "^2.0.1",
"@devoinc/genesys-brand-devo": "^6.5.0",
"@devoinc/genesys-icons": "^5.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/_icon-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@

&::after {
@include icon-font;
position: relative;
content: $gi-exit_close;
position: relative;
font-weight: bold;
}
}
Expand All @@ -151,8 +151,8 @@

&::after {
@include icon-font;
position: relative;
content: $gi-exit_close;
position: relative;
font-weight: bold;
}
}
Expand All @@ -169,8 +169,8 @@

&::after {
@include icon-font;
position: relative;
content: $gi-arrow_down_fat;
position: relative;
font-weight: bold;
}

Expand Down
3 changes: 1 addition & 2 deletions src/components/box-message/_box-message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
border-radius: 0.4rem;

&::before {
@include icon-font;
@include position(1.2rem, null, null, 1.2rem);
position: absolute;
font-size: 1.6rem;
Expand Down Expand Up @@ -109,7 +108,7 @@
background-color: map-deep-get($box-message-status-map, $status, bg-color);

&::before {
content: icon-status($status);
@include icon-status($status);
color: map-deep-get($box-message-status-map, $status, icon-color);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/inline-message/_panel-inline-message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@

&::before {
@include spacing(margin, right, sm, component);
font-family: $icon-font;
// TODO: lt-icon font because lt-icon classes are used in InlineMessage jQuery component
@include icon-font("lt-iconfont, sans-serif");
font-size: 1.8rem;
font-weight: 500;
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/modal/_mixins-modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

#{$parent}__icon {
&::before {
content: icon-status($status);
@include icon-status($status);
}

color: map-deep-get($modal-status-map, $status, icon-bg-color);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/table/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@
background-color: $cmp-table-row-color-background-odd-base;

&::before {
@include icon-font;
@include text-color($color: weak);
@include icon-font;
content: $gi-row_drag_drop;
position: relative;
left: calc(map-deep-get($spacing-size-map, xs, component) * -1);
content: $gi-row_drag_drop;
font-size: 1.8rem;
transition: all .3s ease;
}
Expand Down Expand Up @@ -305,13 +305,13 @@
cursor: move;

&::after {
@include icon-font;
@include text-color($color: weak);
@include icon-font;
content: $gi-row_drag_drop;
position: absolute;
top: 50%;
left: calc(#{$draggable-icon-width} * -1);
transform: translateY(-50%);
content: $gi-row_drag_drop;
width: $draggable-icon-width;
font-size: 1.8rem;
visibility: hidden;
Expand Down
6 changes: 1 addition & 5 deletions src/components/toast/_item-toast.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
flex-shrink: 0;
margin-right: $cmp-toast-header-icon-space-margin-right;
font-size: $cmp-toast-header-icon-typo-font-size-md;

&::before {
@include icon-font;
}
}

#{$toast}__heading {
Expand Down Expand Up @@ -190,7 +186,7 @@
color: map-deep-get($toast-status-map, $status, icon-text-color);

&::before {
content: icon-status($status);
@include icon-status($status);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/validation/_mixins-validation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

&::before {
@include text-color-status($status);
content: icon-status($status);
@include icon-status($status);

@if ($status == warning) {
@include text-color-status(warning-weak);
Expand Down
1 change: 0 additions & 1 deletion src/components/validation/_validation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

&::before {
@include inline-flex(null, center, center);
@include icon-font;
}

&:empty {
Expand Down
8 changes: 4 additions & 4 deletions src/utils/functions/_index.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// -------------------------- FUNCTIONS - UTILS ----------------------------- //


// Base - Functions

@import "./base-functions/icons-functions";

// Utils - Functions

@import "./utils-functions/important-functions";
@import "./utils-functions/map-deep-functions";
@import "./utils-functions/selectors-functions";

// Base - Functions

@import "./base-functions/icons-functions";
2 changes: 1 addition & 1 deletion src/utils/functions/base-functions/_icons-functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// STATUS - ICONS - BASE - FUNCTIONS ---------------------------------------- //

@function icon-status($status, $filled: true) {
@function get-icon-status($status, $filled: true) {
$type: filled;

@if ($filled == false) {
Expand Down
12 changes: 10 additions & 2 deletions src/utils/mixins/base-mixins/_icons-mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

// ICON FONT - ICONS - BASE - MIXINS ---------------------------------------- //

@mixin icon-font($font: $icon-font) {
font-family: $font, sans-serif;
@mixin icon-font($font-family: $gi-icon-font-family) {
font-family: $font-family;
speak: none;
font-style: normal;
font-weight: normal;
Expand All @@ -14,3 +14,11 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}


// ICON STATUS - ICONS - BASE - MIXINS -------------------------------------- //

@mixin icon-status($status, $filled: true) {
@include icon-font;
content: get-icon-status($status);
}
2 changes: 1 addition & 1 deletion src/utils/mixins/components-mixins/_button-mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

@if $has-bold-icon {
&::before,
[class*=#{$icon-class-prefix}] {
[class*=#{$gi-icon-class-prefix}] {
font-weight: bold;
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/utils/variables/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@

$theme: light !default;

// Utils - Variables

@import "./utils-variables/spacing-variables";

// Base - Variables

@import "./base-variables/fonts-variables";
@import "./base-variables/icons-variables";
@import "./base-variables/images-variables";
@import "./base-variables/typography-variables";

// Utils - Variables

@import "./utils-variables/spacing-variables";

// Components - Variables

@import "./components-variables/badge-variables";
Expand Down
19 changes: 0 additions & 19 deletions src/utils/variables/base-variables/_fonts-variables.scss

This file was deleted.

9 changes: 9 additions & 0 deletions src/utils/variables/base-variables/_icons-variables.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
// ------------------------ ICONS - BASE - VARIABLES ------------------------ //


// FONT FAMILIES - ICONS - BASE - VARIABLES --------------------------------- //

$gi-icon-font-name: "gi";
$gi-icon-font-family: $gi-icon-font-name, sans-serif;
$gi-icon-class-prefix: "gi-";


// STATUS - ICONS - BASE - VARIABLES ---------------------------------------- //

$icon-status-list: error, help, info, success, warning;
Expand Down Expand Up @@ -27,6 +35,7 @@ $icon-status-map: (
),
);


// SIZE - ICONS - BASE - VARIABLES ------------------------------------------ //

$icon-size-list: xxxs, xxxs, xxs, xs, sm, md, lg, xl, xxl, xxxl, xxxxl;
Expand Down
6 changes: 3 additions & 3 deletions src/vendors/custom-vendors/_select2-custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
width: map-deep-get($select-size-map, md, arrow-width);

&::before {
@include icon-font;
@include field-control-typo($props: font-size);
@include icon-font;
content: $gi-arrow_down_fat;
font-weight: bold;
}
Expand Down Expand Up @@ -372,7 +372,7 @@
font-weight: 500;

&::before {
content: icon-status(success);
@include icon-status(success);
color: $alias-color-text-feedback-success-weak;
}
}
Expand All @@ -382,7 +382,7 @@
font-weight: 500;

&::before {
content: icon-status(warning);
@include icon-status(warning);
color: $alias-color-text-feedback-warning-base;
}
}
Expand Down

0 comments on commit a001554

Please sign in to comment.