Skip to content

Commit

Permalink
Merge pull request #2919 from quiple/fix-font-family
Browse files Browse the repository at this point in the history
Remove `className={locale}` and add `lang` attribute to `LanguageButton()`
  • Loading branch information
mikecao authored Oct 25, 2024
2 parents 9ad9f7c + 01fc293 commit 2ed22f8
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function RealtimeCountries({ data }) {

const renderCountryName = useCallback(
({ x: code }) => (
<span className={classNames(locale, styles.row)}>
<span className={classNames(styles.row)}>
<TypeIcon type="country" value={code?.toLowerCase()} />
{countryNames[code]}
</span>
Expand Down
1 change: 0 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import '@fontsource/inter/400.css';
import '@fontsource/inter/700.css';
import '@fontsource/inter/800.css';
import 'react-basics/dist/styles.css';
import 'styles/locale.css';
import 'styles/index.css';
import 'styles/variables.css';

Expand Down
4 changes: 2 additions & 2 deletions src/components/input/LanguageButton.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 />
Expand Down
7 changes: 1 addition & 6 deletions src/components/metrics/CountriesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ export function CountriesTable({ ...props }: MetricsTableProps) {

const renderLink = ({ x: code }) => {
return (
<FilterLink
id="country"
className={locale}
value={countryNames[code] && code}
label={formatCountry(code)}
>
<FilterLink id="country" value={countryNames[code] && code} label={formatCountry(code)}>
<TypeIcon type="country" value={code?.toLowerCase()} />
</FilterLink>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/metrics/LanguagesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function LanguagesTable({
const languageNames = useLanguageNames(locale);

const renderLabel = ({ x }) => {
return <div className={locale}>{languageNames[x?.split('-')[0]] ?? x}</div>;
return languageNames[x?.split('-')[0]] ?? x;
};

return (
Expand Down
5 changes: 1 addition & 4 deletions src/components/metrics/Legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -13,8 +12,6 @@ export function Legend({
items: any[];
onClick: (index: LegendItem) => void;
}) {
const { locale } = useLocale();

if (!items.find(({ text }) => text)) {
return null;
}
Expand All @@ -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>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/metrics/RegionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function RegionsTable(props: MetricsTableProps) {

const renderLink = ({ x: code, country }) => {
return (
<FilterLink id="region" className={locale} value={code} label={getRegionName(code, country)}>
<FilterLink id="region" value={code} label={getRegionName(code, country)}>
<TypeIcon type="country" value={country?.toLowerCase()} />
</FilterLink>
);
Expand Down
29 changes: 0 additions & 29 deletions src/styles/locale.css

This file was deleted.

0 comments on commit 2ed22f8

Please sign in to comment.