Skip to content

Commit 6abe056

Browse files
committed
fix: shortDesc max length and primary color
1 parent 2bc6525 commit 6abe056

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/hooks/use-change-root-color.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import { isEmpty } from 'lodash';
2+
13
export const useChangeRootColor = (color, rootColor = 'primary') => {
2-
if (typeof document !== 'undefined' && color) {
4+
if (typeof document !== 'undefined' && !isEmpty(color)) {
35
const root = document.documentElement;
4-
root.style.setProperty(`--colors-${rootColor}`, color);
6+
const currentColor = root.style.getPropertyValue(`--colors-${rootColor}`);
7+
if (currentColor !== color) {
8+
root.style.setProperty(`--colors-${rootColor}`, color);
9+
}
510
}
611
};

src/lib/user-builder.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
extractSocialNetworks,
1919
getUserFavicon,
2020
} from '@utils/user-mapping';
21-
import { get, map, chunk, first, orderBy, union, size, includes, isEmpty } from 'lodash';
21+
import { get, map, chunk, first, orderBy, union, size, includes, isEmpty, truncate } from 'lodash';
2222
import { updateUser, upsertUser } from '@services/user';
2323
import {
2424
GITHUB_API_URL,
@@ -229,7 +229,10 @@ const getDevcoverUser = async (username, baseUser = {}, userBioArray = [], isPre
229229
user.username = toLowerCase(username);
230230
user.ga = get(userData, 'ga', null);
231231
user.repos = selectFirstWithValue(get(userData, 'repos'), get(user, 'github.repos', []));
232-
user.shortBio = get(userData, 'shortBio', getStringByCriteria(userBioArray, 'shortest')) || '';
232+
user.shortBio =
233+
truncate(get(userData, 'shortBio', getStringByCriteria(userBioArray, 'shortest')), {
234+
length: 120,
235+
}) || '';
233236
user.largeBio = get(userData, 'largeBio', getStringByCriteria(userBioArray)) || '';
234237
user.hasGithub = isPreview
235238
? get(userData, 'hasGithub', false)

0 commit comments

Comments
 (0)