Refactor: remove "Soapbox i18n" font and clean up code

This commit is contained in:
danidfra 2024-11-19 17:26:05 -03:00
parent cffc34c7cf
commit 686367b6e0
5 changed files with 9 additions and 124 deletions

View File

@ -25,14 +25,6 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
const themeCss = generateThemeCss(demo ? normalizeSoapboxConfig({ brandColor: '#0482d8' }) : soapboxConfig);
const dsn = soapboxConfig.sentryDsn;
const loadLocaleCss = async (locale: string) => {
if (locale === 'ar') {
await import('soapbox/styles/i18n/arabic.css');
} else if (locale === 'jv') {
await import('soapbox/styles/i18n/javanese.css');
}
};
const bodyClass = clsx('h-full bg-white text-base black:bg-black dark:bg-gray-800', {
'no-reduce-motion': !reduceMotion,
'underline-links': underlineLinks,
@ -40,7 +32,6 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
});
useEffect(() => {
loadLocaleCss(locale);
if (dsn) {
startSentry(dsn).catch(console.error);
@ -57,7 +48,10 @@ const SoapboxHead: React.FC<ISoapboxHead> = ({ children }) => {
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{['dark', 'black'].includes(theme) && <style type='text/css'>{':root { color-scheme: dark; }'}</style>}
{/* eslint-disable formatjs/no-literal-string-in-jsx */}
{(locale === 'ar' || locale === 'jv') ? <style type='text/css'>{':root { font-family: \'Soapbox i18n\'; }'}</style> : <style type='text/css'>{':root { font-family: \'Inter\'; }'}</style>}
{['ar', 'jv'].includes(locale) ? <style type='text/css'>{`
html[lang='ar'] * { font-family: 'Vazirmatn' !important; }
html[lang='jv'] * { font-family: 'Noto Sans Javanese' !important; }
`}</style> : <style type='text/css'>{'* { font-family: \'Inter\'; }'}</style>}
{/* eslint-enable formatjs/no-literal-string-in-jsx */}
<meta name='theme-color' content={soapboxConfig.brandColor} />
</Helmet>

View File

@ -12,6 +12,8 @@ import '@fontsource/inter/500.css';
import '@fontsource/inter/600.css';
import '@fontsource/inter/700.css';
import '@fontsource/inter/900.css';
import '@fontsource/vazirmatn/arabic.css';
import '@fontsource/noto-sans-javanese/javanese.css';
import '@fontsource/roboto-mono/400.css';
import 'line-awesome/dist/font-awesome-line-awesome/css/all.css';
import 'soapbox/features/nostr/keyring.ts';

View File

@ -1,71 +0,0 @@
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 200;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-200-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-200-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 300;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-300-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-300-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 400;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-400-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-400-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 500;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-500-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-500-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 600;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-600-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-600-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 700;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-700-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-700-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 800;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-800-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-800-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 900;
src: url('@fontsource/vazirmatn/files/vazirmatn-arabic-900-normal.woff2') format('woff2'), url('@fontsource/vazirmatn/files/vazirmatn-arabic-900-normal.woff') format('woff');
unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+067E, U+0686, U+0698, U+06AF, U+06CC;
}

View File

@ -1,39 +0,0 @@
/* noto-sans-javanese-javanese-400-normal */
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 400;
src: url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-400-normal.woff2) format('woff2'), url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-400-normal.woff) format('woff');
unicode-range: U+A980-A9DF;
}
/* noto-sans-javanese-javanese-500-normal */
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 500;
src: url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-500-normal.woff2) format('woff2'), url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-500-normal.woff) format('woff');
unicode-range: U+A980-A9DF;
}
/* noto-sans-javanese-javanese-600-normal */
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 600;
src: url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-600-normal.woff2) format('woff2'), url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-600-normal.woff) format('woff');
unicode-range: U+A980-A9DF;
}
/* noto-sans-javanese-javanese-700-normal */
@font-face {
font-family: 'Soapbox i18n';
font-style: normal;
font-display: swap;
font-weight: 700;
src: url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-700-normal.woff2) format('woff2'), url(@fontsource/noto-sans-javanese/files/noto-sans-javanese-javanese-700-normal.woff) format('woff');
unicode-range: U+A980-A9DF;
}

View File

@ -28,7 +28,6 @@ const config: Config = {
},
fontFamily: {
sans: [
'Soapbox i18n',
'Inter',
'ui-sans-serif',
'system-ui',