Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
Chore: Replace a / b with math.div(a, b) on SCSS files (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Apr 1, 2022
1 parent 7e6ff4b commit 1cb7ae4
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 26 deletions.
16 changes: 9 additions & 7 deletions src/components/Button/styles.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
@use 'sass:math';

@import '../../styles/colors';
@import '../../styles/helpers';
@import '../../styles/variables';

$button-border-width: $default-border;
$button-border-radius: $default-border-radius;
$button-padding: (0.75 * $default-gap - $default-border) (1.5 * $default-gap - $default-border);
$button-small-padding: (0.25 * $default-gap - $default-border / 2) (1.5 * $default-gap - $default-border);
$button-small-padding: (0.25 * $default-gap - math.div($default-border, 2)) (1.5 * $default-gap - $default-border);

$button-active-displacement: 2px;

Expand All @@ -22,7 +24,7 @@ $button-line-height: 1.25rem;
$button-disabled-opacity: $disabled-opacity;

$button-loading-border-width: (2 * $default-border);
$button-loading-gap: ($default-gap / 2);
$button-loading-gap: math.div($default-gap, 2);
$button-loading-size: $button-line-height;
$button-loading-color: #ffffff;

Expand Down Expand Up @@ -66,7 +68,7 @@ $button-icon-padding: 10px;
color $default-time-animation,
background-color $default-time-animation,
border-color $default-time-animation,
transform $default-time-animation / 2;
transform math.div($default-time-animation, 2);
white-space: nowrap;
text-decoration: none;

Expand Down Expand Up @@ -177,18 +179,18 @@ $button-icon-padding: 10px;

&__badge {
position: absolute;
top: (-$button-badge-size / 3);
right: (-$button-badge-size / 3);
top: math.div(-$button-badge-size, 3);
right: math.div(-$button-badge-size, 3);

min-width: $button-badge-size;
height: $button-badge-size;
padding: 0 ($button-badge-font-size / 2);
padding: 0 math.div($button-badge-font-size, 2);

text-align: center;
letter-spacing: 0;

color: $button-badge-color;
border-radius: ($button-badge-size / 2);
border-radius: math.div($button-badge-size, 2);

background-color: $button-badge-background-color;
box-shadow: $button-badge-shadow;
Expand Down
4 changes: 3 additions & 1 deletion src/components/ButtonGroup/styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@use 'sass:math';

@import '../../styles/variables';

$button-group-margin: ($default-gap / 4);
$button-group-margin: math.div($default-gap, 4);

.button-group {
display: flex;
Expand Down
4 changes: 3 additions & 1 deletion src/components/Form/mixins.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@use 'sass:math';

@import '../../styles/variables';
@import '../../styles/colors';

$form-input-border-width: $default-border;
$form-input-border-radius: $default-border-radius;
$form-input-padding: (0.75 * $default-gap - $default-border);
$form-input-small-padding: (0.25 * $default-gap - $default-border / 2) (0.75 * $default-gap - $default-border);
$form-input-small-padding: (0.25 * $default-gap - math.div($default-border, 2)) (0.75 * $default-gap - $default-border);
$form-input-color: $color-text-dark;
$form-input-placeholder-color: $color-text-light;
$form-input-background-color: $bg-color-white;
Expand Down
6 changes: 4 additions & 2 deletions src/components/Header/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:math';

@import '../../styles/colors';
@import '../../styles/helpers';
@import '../../styles/variables';
Expand All @@ -18,7 +20,7 @@ $header-action-active-displacement: 2px;

width: 100%;
height: $header-height;
padding: 0 $header-padding / 2;
padding: 0 math.div($header-padding, 2);

color: var(--font-color, $header-color);
background-color: var(--color, $header-background-color);
Expand All @@ -31,7 +33,7 @@ $header-action-active-displacement: 2px;
&__item {
flex: 0 0 auto;

margin: 0 $header-padding / 2;
margin: 0 math.div($header-padding, 2);
}

&__picture {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Menu/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:math';

@import '../../styles/colors';
@import '../../styles/variables';

Expand All @@ -11,7 +13,7 @@
transition:
opacity $default-time-animation,
visibility $default-time-animation,
transform $default-time-animation / 2;
transform math.div($default-time-animation, 2);

border-radius: 4px;
background: $bg-color-white;
Expand Down
4 changes: 3 additions & 1 deletion src/components/Messages/MessageContainer/styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@use 'sass:math';

@import '../../../styles/variables';

$message-container-margin: 0 0 $default-padding 0;
$message-container-compact-margin: 0 0 ($default-padding / 4) 0;
$message-container-compact-margin: 0 0 math.div($default-padding, 4) 0;

.message-container {
display: flex;
Expand Down
8 changes: 5 additions & 3 deletions src/components/Messages/MessageContent/styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@use 'sass:math';

@import '../../../styles/variables';

$message-content-gap: ($default-gap / 2);
$message-content-margin: (-$message-content-gap / 2) ($default-gap / 2);
$message-content-gap: math.div($default-gap, 2);
$message-content-margin: math.div(-$message-content-gap, 2) math.div($default-gap, 2);

.message-content {
display: flex;
Expand All @@ -11,7 +13,7 @@ $message-content-margin: (-$message-content-gap / 2) ($default-gap / 2);
align-items: flex-start;

> * {
margin: ($message-content-gap / 2) 0;
margin: math.div($message-content-gap, 2) 0;
}

&--reverse {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Messages/MessageTime/styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@use 'sass:math';

@import '../../../styles/colors';
@import '../../../styles/variables';

$message-time-margin: 0 ($default-gap / 2);
$message-time-margin: 0 math.div($default-gap, 2);
$message-time-font-size: 0.625rem;
$message-time-line-height: 1rem;
$message-time-color: $color-text-grey;
Expand Down
4 changes: 3 additions & 1 deletion src/components/Screen/styles.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@use 'sass:math';

@import '../../styles/colors';

$screen-padding: 16px;
$screen-box-shadow: 0 ($screen-padding / 2 - 1) $screen-padding 0 rgba(0, 0, 0, 0.1);
$screen-box-shadow: 0 (math.div($screen-padding, 2) - 1) $screen-padding 0 rgba(0, 0, 0, 0.1);
$max-lines: 12;

.screen {
Expand Down
14 changes: 8 additions & 6 deletions src/components/uiKit/message/ButtonElement/styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:math';

@import '../../../../styles/colors';
@import '../../../../styles/helpers';
@import '../../../../styles/variables';
Expand All @@ -17,7 +19,7 @@
color $default-time-animation,
background-color $default-time-animation,
border-color $default-time-animation,
transform $default-time-animation / 2;
transform math.div($default-time-animation, 2);
white-space: nowrap;
text-decoration: none;

Expand Down Expand Up @@ -58,11 +60,11 @@
content: "";

transition:
opacity $default-time-animation / 2,
border-width $default-time-animation / 2,
width $default-time-animation / 2,
height $default-time-animation / 2,
visibility $default-time-animation / 2;
opacity math.div($default-time-animation, 2),
border-width math.div($default-time-animation, 2),
width math.div($default-time-animation, 2),
height math.div($default-time-animation, 2),
visibility math.div($default-time-animation, 2);
animation: button-loading-rotation 1s linear infinite;

opacity: 0;
Expand Down
6 changes: 4 additions & 2 deletions src/styles/grid.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//----- Grid System
@use 'sass:math';

@import "helpers";

//----- Extends
Expand Down Expand Up @@ -37,7 +39,7 @@ $cols: 12;
@for $i from 1 through $cols {
.col-#{$i},
%col-#{$i} {
width: (100% / ($cols / $i)) - ($grid-spacing * ($cols - $i) / $cols);
width: math.div(100%, math.div($cols, $i)) - ($grid-spacing * math.div(($cols - $i), $cols));
}
}

Expand All @@ -46,7 +48,7 @@ $cols: 12;
@for $i from 1 through $cols {
.col-#{$breakpoint}-#{$i},
%col-#{$breakpoint}-#{$i} {
width: (100% / ($cols / $i)) - ($grid-spacing * ($cols - $i) / $cols);
width: math.div(100%, math.div($cols, $i)) - ($grid-spacing * math.div(($cols - $i), $cols));
}
}
}
Expand Down

0 comments on commit 1cb7ae4

Please sign in to comment.