Skip to content

Commit 670d44c

Browse files
committed
refactor: update tag styles
1 parent ab9be6e commit 670d44c

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

client/src/components/Tags/index.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
flex: 1;
2323
margin: 3px 3px;
2424
padding: .2rem .6rem;
25+
&:hover {
26+
opacity: .7;
27+
}
2528
}
2629

2730
.link {

client/src/utils/index.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
import { TAG_COLORS } from "@/constants";
2-
31
const colors = ['#52c41a', '#f5222d', '#1890ff', '#faad14', '#ff0064', '#722ed1'];
42

3+
const tagColors = [
4+
'#dc3545',
5+
'#17a2b8',
6+
'#00b74a',
7+
'#fc651f',
8+
'#6c757d',
9+
'#f5c800',
10+
'#808695',
11+
'#2db7f5',
12+
'#87d068',
13+
'#108ee9',
14+
'#52c41a',
15+
'#f5222d',
16+
'#1890ff',
17+
'#faad14',
18+
'#ff0064',
19+
'#722ed1',
20+
];
21+
522
export const getRandomColor = (() => {
623
const cache = {};
724
return (key): string => {
@@ -37,7 +54,6 @@ export function throttle(fn, threshhold) {
3754
};
3855
}
3956

40-
4157
export function elementInViewport(el) {
4258
let top = el.offsetTop;
4359
let left = el.offsetLeft;
@@ -71,7 +87,6 @@ export function download({ name, url }) {
7187
document.body.removeChild(eleLink);
7288
}
7389

74-
7590
export const groupBy = function (data, condition) {
7691
if (!condition || !Array.isArray(data)) {
7792
return data;
@@ -149,10 +164,7 @@ export const scrollToBottom = (el: HTMLElement) => {
149164
el.scrollTo(0, currentScrollTop + (scrollHeight - currentScrollTop - clientHeight));
150165
};
151166

152-
153-
154167
export function getColorFromNumber(num) {
155-
const colors = ['#dc3545', '#17a2b8', '#00b74a', '#fc651f', '#6c757d', '#f5c800', '#808695'].concat(TAG_COLORS);
156-
const index = num % colors.length;
157-
return colors[index];
158-
}
168+
const index = num % tagColors.length;
169+
return tagColors[index];
170+
}

0 commit comments

Comments
 (0)