Skip to content

Commit e697f21

Browse files
refactor(Stat): move null value variable to constants file
1 parent df64fbf commit e697f21

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/Stat/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import type { IconType } from "react-icons/lib"
33
import { MdInfoOutline, MdWarning } from "react-icons/md"
44
import { Flex, HStack, Icon, Text } from "@chakra-ui/react"
55

6-
import Tooltip, { type TooltipProps } from "../Tooltip"
6+
import { NULL_VALUE } from "@/lib/constants"
77

8-
const nullValue = <>&mdash;</>
8+
import Tooltip, { type TooltipProps } from "../Tooltip"
99

1010
const initialContent = {
11-
contentValue: nullValue,
11+
contentValue: NULL_VALUE,
1212
tooltipIcon: MdInfoOutline,
1313
}
1414

@@ -28,7 +28,7 @@ const Stat = ({ tooltipProps, value, label, isError }: StatProps) => {
2828
React.useEffect(() => {
2929
if (isError) {
3030
return setContent({
31-
contentValue: nullValue,
31+
contentValue: NULL_VALUE,
3232
tooltipIcon: MdWarning,
3333
})
3434
}

src/lib/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export const TRANSLATED_IMAGES_DIR = "/content/translations"
1111
export const PLACEHOLDER_IMAGE_DIR = "src/data/placeholders"
1212
export const INTL_JSON_DIR = "src/intl"
1313

14+
export const NULL_VALUE = "—"
15+
1416
// i18n
1517
export const DEFAULT_LOCALE = "en"
1618
export const FAKE_LOCALE = "default"

0 commit comments

Comments
 (0)