Skip to content

Commit 630e040

Browse files
committed
fix terminal warnings
1 parent 6a3d2eb commit 630e040

26 files changed

Lines changed: 86 additions & 72 deletions

File tree

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react'
2-
import './App.css'
2+
import 'src/assets/App.css'
33
import { Footer, Header } from 'src/components/Layout'
44
import { BookmarksSidebar } from 'src/features/bookmarks'
55
import { MarketingBanner } from 'src/components/Elements'
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
@font-face {
22
font-family: 'Nunito';
3-
src: url("assets/fonts/nunito/nunito-regular.woff2") format('woff2');
3+
src: url("fonts/nunito/nunito-regular.woff2") format('woff2');
44
}
55

66
@font-face {
77
font-family: 'Nunito';
88
font-weight: 600;
99
font-style: normal;
10-
src: url("assets/fonts/nunito/nunito-semibold.woff2") format('woff2');
10+
src: url("fonts/nunito/nunito-semibold.woff2") format('woff2');
1111
}
1212

1313
html.dark {

src/components/CardLink.js

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from 'react'
2+
import ClickableItem from '../../ClickableItem'
3+
4+
type CardLinkProps = {
5+
link: string
6+
children: React.ReactNode
7+
className?: string
8+
appendRef?: boolean
9+
analyticsAttributes: {
10+
[key: string]: string | number | undefined
11+
}
12+
}
13+
export const CardLink = ({
14+
link,
15+
children,
16+
className = '',
17+
appendRef = true,
18+
analyticsAttributes,
19+
}: CardLinkProps) => {
20+
return (
21+
<ClickableItem
22+
link={link}
23+
className={'rowTitle' + (className ? ` ${className}` : '')}
24+
analyticsAttributes={analyticsAttributes}
25+
appendRef={appendRef}>
26+
{children}
27+
</ClickableItem>
28+
)
29+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./CardLink"

src/components/Elements/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ export * from "./Card"
33
export * from "./MarketingBanner"
44
export * from "./SearchBar"
55
export * from "./UserTags"
6-
export * from "./BottomNavigation"
6+
export * from "./BottomNavigation"
7+
export * from "./CardLink"

src/components/ScrollCardsNavigator.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect, useLayoutEffect, useRef } from 'react'
1+
import React, { useState, useEffect, useLayoutEffect, useRef, useCallback } from 'react'
22
import { FiChevronLeft, FiChevronRight } from 'react-icons/fi'
33
import { maxCardsPerRow } from 'src/config'
44
import { useUserPreferences } from 'src/stores/preferences'
@@ -17,13 +17,13 @@ function ScrollCardsNavigator() {
1717
setRightButtonVisible(scrollRight > 0)
1818
}
1919

20-
const handleKeyboardKeys = (e) => {
20+
const handleKeyboardKeys = useCallback((e) => {
2121
if (e.keyCode === 37) {
2222
scrollTo('left')
2323
} else if (e.keyCode === 39) {
2424
scrollTo('right')
2525
}
26-
}
26+
}, [])
2727

2828
useLayoutEffect(() => {
2929
scrollBarContainer.current = document.querySelector('.AppContent')
@@ -36,7 +36,7 @@ function ScrollCardsNavigator() {
3636
window.removeEventListener('keydown', handleKeyboardKeys)
3737
scrollBarContainer.current.removeEventListener('scroll', handleScroll)
3838
}
39-
}, [])
39+
}, [handleKeyboardKeys])
4040

4141
useEffect(() => {
4242
setLeftButtonVisible(false)

src/components/SelectableCard.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useLayoutEffect } from 'react'
1+
import { useCallback, useLayoutEffect } from 'react'
22
import DropDownMenu from './DropDownMenu'
33
import { GLOBAL_TAG, MY_LANGUAGES_TAG } from 'src/config'
44
import { useUserPreferences } from 'src/stores/preferences'
@@ -20,35 +20,40 @@ function SelectableCard({
2020
mergedTags = [...userSelectedTags, GLOBAL_TAG, MY_LANGUAGES_TAG]
2121
}
2222

23-
const getInitialSelectedTagValue = () => {
23+
const findTagByValue = useCallback(
24+
(value) => {
25+
if (!value) {
26+
return null
27+
}
28+
29+
return mergedTags.find((t) => t.value === value)
30+
},
31+
[mergedTags]
32+
)
33+
34+
const findTagByLabel = useCallback(
35+
(name) => {
36+
if (!name) {
37+
return null
38+
}
39+
40+
return mergedTags.find((t) => t.label === name)
41+
},
42+
[mergedTags]
43+
)
44+
const getInitialSelectedTagValue = useCallback(() => {
2445
if (isLanguage) {
2546
return findTagByLabel(cardSettings) ?? fallbackTag
2647
} else {
2748
return findTagByValue(cardSettings) ?? fallbackTag
2849
}
29-
}
30-
31-
const findTagByValue = (value) => {
32-
if (!value) {
33-
return null
34-
}
35-
36-
return mergedTags.find((t) => t.value === value)
37-
}
38-
39-
const findTagByLabel = (name) => {
40-
if (!name) {
41-
return null
42-
}
43-
44-
return mergedTags.find((t) => t.label === name)
45-
}
50+
}, [cardSettings, fallbackTag, findTagByLabel, findTagByValue, isLanguage])
4651

4752
useLayoutEffect(() => {
4853
if (selectedTag == null) {
4954
setSelectedTag(getInitialSelectedTagValue())
5055
}
51-
}, [])
56+
}, [getInitialSelectedTagValue, selectedTag, setSelectedTag])
5257

5358
return (
5459
<DropDownMenu

0 commit comments

Comments
 (0)