Skip to content

Commit 016d5af

Browse files
committed
Update to shlink-frontend-kit 1.0.0
1 parent cb977b8 commit 016d5af

File tree

8 files changed

+31
-85
lines changed

8 files changed

+31
-85
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
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).
66

7-
## [Unreleased]
7+
## [0.15.0] - 2025-06-17
88
### Added
99
* *Nothing*
1010

1111
### Changed
12-
* *Nothing*
12+
* Update to shlink-frontend-kit 1.0.0
13+
* No longer use `!important` with tailwind styles
1314

1415
### Deprecated
1516
* *Nothing*

dev/tailwind.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import 'tailwindcss' important;
1+
@import 'tailwindcss';
22
@source '../node_modules/@shlinkio/shlink-frontend-kit';
33
@import '@shlinkio/shlink-frontend-kit/tailwind.preset.css';
44
@import '../src/tailwind.preset.css';

package-lock.json

Lines changed: 4 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@fortawesome/free-solid-svg-icons": "^6.7.2",
4747
"@fortawesome/react-fontawesome": "^0.2.2",
4848
"@reduxjs/toolkit": "^2.5.0",
49-
"@shlinkio/shlink-frontend-kit": "^0.9.13",
49+
"@shlinkio/shlink-frontend-kit": "^1.0.0",
5050
"@shlinkio/shlink-js-sdk": "^2.0.0",
5151
"react": "^18.3 || ^19.0",
5252
"react-dom": "^18.3 || ^19.0",

src/visits/charts/HorizontalBarChart.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {
2+
brandColor,
3+
brandColorAlpha,
24
formatNumber, HIGHLIGHTED_COLOR,
35
HIGHLIGHTED_COLOR_ALPHA,
46
isDarkThemeEnabled,
5-
MAIN_COLOR,
6-
MAIN_COLOR_ALPHA } from '@shlinkio/shlink-frontend-kit';
7+
} from '@shlinkio/shlink-frontend-kit';
78
import type { FC } from 'react';
89
import { useMemo } from 'react';
910
import { Bar, CartesianGrid, Cell, ComposedChart, Tooltip, XAxis, YAxis } from 'recharts';
@@ -99,12 +100,12 @@ export const HorizontalBarChart: FC<HorizontalBarChartProps> = (
99100
dataKey="nonHighlightedAmount"
100101
stackId="main"
101102
cursor="pointer"
102-
fill={MAIN_COLOR /* This needs to be set as it is the color used in the tooltip */}
103+
fill={brandColor() /* This needs to be set as it is the color used in the tooltip */}
103104
onClick={({ name }: HorizontalBarChartEntry) => onClick?.(name)}
104105
>
105106
{chartData.map((entry) => (
106107
// Using a Cell, to define a different fill color, without affecting the one used for the tooltip
107-
<Cell key={entry.name} fill={MAIN_COLOR_ALPHA} stroke={MAIN_COLOR} strokeWidth={2} />
108+
<Cell key={entry.name} fill={brandColorAlpha()} stroke={brandColor()} strokeWidth={2} />
108109
))}
109110
</Bar>
110111
{highlightedStats && (

src/visits/charts/LineChartCard.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ import {
44
} from '@fortawesome/free-solid-svg-icons';
55
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
66
import { countBy } from '@shlinkio/data-manipulation';
7-
import { Card, Dropdown, formatNumber, HIGHLIGHTED_COLOR, isDarkThemeEnabled, LinkButton,MAIN_COLOR, useToggle } from '@shlinkio/shlink-frontend-kit';
7+
import {
8+
brandColor,
9+
Card,
10+
Dropdown,
11+
formatNumber,
12+
HIGHLIGHTED_COLOR,
13+
isDarkThemeEnabled,
14+
LinkButton,
15+
useToggle,
16+
} from '@shlinkio/shlink-frontend-kit';
817
import { clsx } from 'clsx';
918
import type { Duration } from 'date-fns';
1019
import {
@@ -158,11 +167,11 @@ export const visitsListColor = (v: VisitsList) => {
158167
}
159168

160169
const typeColorMap: Record<NonNullable<VisitsList['type']>, string> = {
161-
main: MAIN_COLOR,
170+
main: brandColor(),
162171
highlighted: HIGHLIGHTED_COLOR,
163172
previous: prevColor(),
164173
};
165-
return v.type ? typeColorMap[v.type] : MAIN_COLOR;
174+
return v.type ? typeColorMap[v.type] : brandColor();
166175
};
167176

168177
const useVisitsWithType = (visitsGroups: Record<string, VisitsList>, type: VisitsList['type']) => useMemo(

test/tags/helpers/Tag.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MAIN_COLOR } from '@shlinkio/shlink-frontend-kit';
1+
import { brandColor } from '@shlinkio/shlink-frontend-kit';
22
import { screen } from '@testing-library/react';
33
import { fromPartial } from '@total-typescript/shoehorn';
44
import type { ReactNode } from 'react';
@@ -11,7 +11,7 @@ import { renderWithEvents } from '../../__helpers__/setUpTest';
1111
describe('<Tag />', () => {
1212
const onClick = vi.fn();
1313
const onClose = vi.fn();
14-
const stylesForKey = vi.fn(() => ({ backgroundColor: MAIN_COLOR }));
14+
const stylesForKey = vi.fn(() => ({ backgroundColor: brandColor() }));
1515
const colorGenerator = fromPartial<ColorGenerator>({ stylesForKey });
1616
const setUp = (text: string, clearable?: boolean, children?: ReactNode) => {
1717
const props = !clearable ? { onClick } : { onClose };
@@ -25,7 +25,7 @@ describe('<Tag />', () => {
2525
it('passes a11y checks', () => checkAccessibility(setUp('the-tag')));
2626

2727
it.each([
28-
[MAIN_COLOR],
28+
[brandColor()],
2929
['#8A661C'],
3030
['#F7BE05'],
3131
['#5A02D8'],

test/utils/services/ColorGenerator.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MAIN_COLOR } from '@shlinkio/shlink-frontend-kit';
1+
import { brandColor } from '@shlinkio/shlink-frontend-kit';
22
import { fromPartial } from '@total-typescript/shoehorn';
33
import { ColorGenerator } from '../../../src/utils/services/ColorGenerator';
44
import type { TagColorsStorage } from '../../../src/utils/services/TagColorsStorage';
@@ -47,7 +47,7 @@ describe('ColorGenerator', () => {
4747

4848
describe('stylesForKey', () => {
4949
it.each([
50-
[MAIN_COLOR, '#222'],
50+
[brandColor(), '#222'],
5151
['#8A661C', '#fff'],
5252
['#F7BE05', '#222'],
5353
['#5A02D8', '#fff'],

0 commit comments

Comments
 (0)