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

Replace sass @imports with @use #570

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]
### Added
* *Nothing*

### Changed
* Replace sass `@import`s with `@use`.

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* *Nothing*


## [0.12.1] - 2025-01-02
### Added
* Add support for React 19
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ Make sure you import stylesheets in the order documented here for everything to

```scss
// src/index.scss
@import 'node_modules/@shlinkio/shlink-frontend-kit/dist/base'; // Before bootstrap stylesheet. Includes SASS var overrides
@import 'node_modules/bootstrap/scss/bootstrap.scss';
@import 'node_modules/@shlinkio/shlink-frontend-kit/dist/index'; // After bootstrap. Includes CSS overrides
@import 'node_modules/@shlinkio/shlink-web-component/dist/index';
@use 'node_modules/@shlinkio/shlink-frontend-kit/dist/base'; // Before bootstrap stylesheet
@use 'node_modules/bootstrap/scss/bootstrap.scss' with (
$primary: base.$mainColor // Override bootstrap's primary color
);
@use 'node_modules/@shlinkio/shlink-frontend-kit/dist/index'; // After bootstrap. Includes CSS overrides
@use 'node_modules/@shlinkio/shlink-web-component/dist/index' as c-index;
```

```tsx
Expand Down
14 changes: 8 additions & 6 deletions dev/index.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@import '../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../node_modules/bootstrap/scss/bootstrap.scss';
@import '../node_modules/@shlinkio/shlink-frontend-kit/dist/index';
@import '../src/index.scss';
@use '../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../node_modules/bootstrap/scss/bootstrap.scss' with (
$primary: base.$mainColor
);
@use '../node_modules/@shlinkio/shlink-frontend-kit/dist/index';
@use '../src/index.scss' as dev-index;

.header {
height: $headerHeight;
height: base.$headerHeight;
background-color: var(--brand-color);
}

.wrapper {
padding: $headerHeight 0;
padding: base.$headerHeight 0;
}
8 changes: 4 additions & 4 deletions src/Main.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

.shlink-layout__swipeable {
height: 100%;
Expand All @@ -18,7 +18,7 @@
cursor: pointer;
color: rgb(255 255 255 / .5);

@media (max-width: $smMax) {
@media (max-width: base.$smMax) {
display: inline-block;
}
}
Expand All @@ -31,7 +31,7 @@
padding: 20px 0 0;
min-height: 100%;

@media (min-width: $mdMin) {
padding: 30px 0 0 $asideMenuWidth;
@media (min-width: base.$mdMin) {
padding: 30px 0 0 base.$asideMenuWidth;
}
}
19 changes: 9 additions & 10 deletions src/common/AsideMenu.scss
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
@import '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../utils/mixins/vertical-align';
@use '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

.aside-menu {
width: $asideMenuWidth;
width: base.$asideMenuWidth;
background-color: var(--primary-color);
box-shadow: rgb(0 0 0 / .05) 0 8px 15px;
position: fixed !important;
padding-top: 13px;
padding-bottom: 10px;
top: $headerHeight;
top: base.$headerHeight;
bottom: 0;
left: 0;
display: block;
z-index: 1010;
overflow: hidden auto;

@media (min-width: $mdMin) {
@media (min-width: base.$mdMin) {
padding: 30px 15px 15px;
}

@media (max-width: $smMax) {
@media (max-width: base.$smMax) {
transition: left 300ms;
top: $headerHeight - 3px;
top: base.$headerHeight - 3px;
box-shadow: -10px 0 50px 11px rgb(0 0 0 / .55);
}
}

.aside-menu--hidden {
@media (max-width: $smMax) {
left: -($asideMenuWidth + 35px);
@media (max-width: base.$smMax) {
left: -(base.$asideMenuWidth + 35px);
}
}

Expand All @@ -42,7 +41,7 @@
text-decoration: none !important;
cursor: pointer;

@media (max-width: $smMax) {
@media (max-width: base.$smMax) {
margin: 0;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/domains/DomainSelector.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
@import '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../utils/mixins/vertical-align';
@use '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

.domains-dropdown__toggle-btn.domains-dropdown__toggle-btn,
.domains-dropdown__toggle-btn.domains-dropdown__toggle-btn:hover,
.domains-dropdown__toggle-btn.domains-dropdown__toggle-btn:active {
color: $textPlaceholder !important;
color: base.$textPlaceholder !important;
}

.domains-dropdown__toggle-btn--active.domains-dropdown__toggle-btn--active,
Expand Down
9 changes: 5 additions & 4 deletions src/index.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@import './tags/react-tag-autocomplete';
@import './utils/StickyCardPaginator.scss';
@import 'leaflet/dist/leaflet.css';
@use '../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use './tags/react-tag-autocomplete';
@use './utils/StickyCardPaginator.scss';
@use 'leaflet/dist/leaflet.css';

.top-sticky {
position: sticky;
top: $headerHeight;
top: base.$headerHeight;
z-index: 10;
}
4 changes: 2 additions & 2 deletions src/overview/helpers/HighlightCard.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

.highlight-card.highlight-card.highlight-card {
text-align: center;
Expand All @@ -16,5 +16,5 @@
}

.highlight-card__title {
color: $textPlaceholder;
color: base.$textPlaceholder;
}
4 changes: 2 additions & 2 deletions src/short-urls/helpers/QrCodeModal.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

.qr-code-modal__controls {
@media (min-width: $lgMin) {
@media (min-width: base.$lgMin) {
width: 16rem;
}
}
16 changes: 8 additions & 8 deletions src/short-urls/helpers/ShortUrlsRow.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../../utils/mixins/vertical-align';
@use '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../../utils/mixins/vertical-align';

@mixin text-ellipsis() {
text-overflow: ellipsis;
Expand All @@ -16,17 +16,17 @@
}

.short-urls-row__cell--indivisible {
@media (min-width: $lgMin) {
@media (min-width: base.$lgMin) {
white-space: nowrap;
}
}

.short-urls-row__short-url-wrapper {
@media (max-width: $mdMax) {
@media (max-width: base.$mdMax) {
word-break: break-all;
}

@media (min-width: $lgMin) {
@media (min-width: base.$lgMin) {
@include text-ellipsis();

vertical-align: bottom;
Expand All @@ -36,11 +36,11 @@
}

.short-urls-row__copy-hint {
@include vertical-align(translateX(10px));
@include vertical-align.vertical-align(translateX(10px));

box-shadow: 0 3px 15px rgb(0 0 0 / .25);

@media (max-width: $responsiveTableBreakpoint) {
@include vertical-align(translateX(calc(-100% - 20px)));
@media (max-width: base.$responsiveTableBreakpoint) {
@include vertical-align.vertical-align(translateX(calc(-100% - 20px)));
}
}
8 changes: 4 additions & 4 deletions src/tags/TagsTable.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@import '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../utils/mixins/sticky-cell';
@use '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../utils/mixins/sticky-cell';

.tags-table__header-cell.tags-table__header-cell {
@include sticky-cell(false);
@include sticky-cell.sticky-cell(false);

top: $headerHeight;
top: base.$headerHeight;
position: sticky;
cursor: pointer;
}
6 changes: 3 additions & 3 deletions src/tags/react-tag-autocomplete.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

// Main wrapper
.react-tags {
Expand Down Expand Up @@ -68,7 +68,7 @@
max-width: 100%;
}

@media screen and (min-width: $smMin) {
@media screen and (min-width: base.$smMin) {
.react-tags__combobox {
/* this will become the offsetParent for suggestions */
position: relative;
Expand Down Expand Up @@ -113,7 +113,7 @@
box-shadow: 0 2px 6px rgb(0 0 0 / .2);
}

@media screen and (min-width: $smMin) {
@media screen and (min-width: base.$smMin) {
.react-tags__listbox {
width: 240px;
}
Expand Down
5 changes: 2 additions & 3 deletions src/utils/components/IconInput.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import '../mixins/vertical-align';
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../mixins/vertical-align';

.icon-input-container {
position: relative;
Expand All @@ -14,7 +13,7 @@
}

.icon-input-container__icon {
@include vertical-align();
@include vertical-align.vertical-align();

right: .75rem;
cursor: pointer;
Expand Down
2 changes: 0 additions & 2 deletions src/utils/mixins/sticky-cell.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

@mixin sticky-cell($with-separators: true) {
z-index: 1;
position: relative;
Expand Down
12 changes: 6 additions & 6 deletions src/visits/VisitsTable.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../utils/mixins/sticky-cell';
@use '../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../utils/mixins/sticky-cell';

.visits-table {
background-color: var(--primary-color);
Expand All @@ -10,11 +10,11 @@
cursor: pointer;
margin-bottom: 55px;

@include sticky-cell();
@include sticky-cell.sticky-cell();

@media (min-width: $mdMin) {
@media (min-width: base.$mdMin) {
&.visits-table__sticky {
top: $headerHeight + 40px;
top: base.$headerHeight + 40px;
}
}
}
Expand All @@ -28,7 +28,7 @@
bottom: 0;
margin-top: 34px;

@include sticky-cell();
@include sticky-cell.sticky-cell();
}

.visits-table__sticky.visits-table__sticky {
Expand Down
4 changes: 2 additions & 2 deletions src/visits/charts/DoughnutChartLegend.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';

.doughnut-chart-legend {
list-style-type: none;
padding: 0;
margin: 0;

@media (max-width: $smMax) {
@media (max-width: base.$smMax) {
margin-top: 1rem;
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/visits/helpers/MapModal.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@import '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@import '../../utils/mixins/fit-with-margin';
@use '../../../node_modules/@shlinkio/shlink-frontend-kit/dist/base';
@use '../../utils/mixins/fit-with-margin';

.map-modal__modal.map-modal__modal {
@media (min-width: $mdMin) {
@media (min-width: base.$mdMin) {
$margin: 20px;

@include fit-with-margin($margin);
@include fit-with-margin.fit-with-margin($margin);
}

@media (max-width: $smMax) {
@media (max-width: base.$smMax) {
$margin: 10px;

@include fit-with-margin($margin);
@include fit-with-margin.fit-with-margin($margin);
}
}

Expand Down
Loading