This commit is contained in:
Minseo Lee 2024-08-29 14:55:55 +09:00
commit cb0210a72c
5 changed files with 4 additions and 43 deletions

View file

@ -1,4 +1,4 @@
import { Icon, Button, PopupTrigger, Popup, Text } from 'react-basics';
import { Icon, Button, PopupTrigger, Popup } from 'react-basics';
import classNames from 'classnames';
import { languages } from 'lib/lang';
import { useLocale } from 'components/hooks';
@ -33,7 +33,7 @@ export function LanguageButton() {
className={classNames(styles.item, { [styles.selected]: value === locale })}
onClick={(e: any) => handleSelect(value, close, e)}
>
<Text>{label}</Text>
<span lang={value}>{label}</span>
{value === locale && (
<Icon className={styles.icon}>
<Icons.Check />

View file

@ -1,7 +1,6 @@
import MetricsTable, { MetricsTableProps } from './MetricsTable';
import { percentFilter } from 'lib/filters';
import { useIntl } from 'react-intl';
import { useLocale } from 'components/hooks';
import { useMessages } from 'components/hooks';
export function LanguagesTable({
@ -9,15 +8,10 @@ export function LanguagesTable({
...props
}: { onDataLoad: (data: any) => void } & MetricsTableProps) {
const { formatMessage, labels } = useMessages();
const { locale } = useLocale();
const intl = useIntl();
const renderLabel = ({ x }) => {
return (
<div className={locale}>
{intl.formatDisplayName(x?.split('-')[0], { type: 'language' }) ?? x}
</div>
);
return intl.formatDisplayName(x?.split('-')[0], { type: 'language' }) ?? x;
};
return (

View file

@ -3,7 +3,6 @@ import { safeDecodeURIComponent } from 'next-basics';
import { colord } from 'colord';
import classNames from 'classnames';
import { LegendItem } from 'chart.js/auto';
import { useLocale } from 'components/hooks';
import styles from './Legend.module.css';
export function Legend({
@ -13,8 +12,6 @@ export function Legend({
items: any[];
onClick: (index: LegendItem) => void;
}) {
const { locale } = useLocale();
if (!items.find(({ text }) => text)) {
return null;
}
@ -32,7 +29,7 @@ export function Legend({
onClick={() => onClick(item)}
>
<StatusLight color={color.alpha(color.alpha() + 0.2).toHex()}>
<span className={locale}>{safeDecodeURIComponent(text)}</span>
{safeDecodeURIComponent(text)}
</StatusLight>
</div>
);