More fixes

This commit is contained in:
Gnarwhal 2024-09-19 04:08:14 +00:00
parent 56d393fcc8
commit 0b544fc507
Signed by: Gnarwhal
GPG key ID: B9B7561C0C90884D
3 changed files with 4 additions and 3 deletions

View file

@ -89,7 +89,7 @@ export default function Content({ src }: { src: string}) {
json: "json", json: "json",
} }
const split = window.location.pathname.split('.'); const split = window.location.pathname.split('.');
set_content(<Text language={split.length == 0 ? 'none' : languages[split[split.length - 1]]} text={data} />); set_content(<Text language={split.length == 0 ? 'none' : (languages[split[split.length - 1] as keyof typeof languages] ?? 'none')} text={data} />);
} }
}; };
} }

View file

@ -9,6 +9,7 @@ export const group = style({
lineHeight: '1.4em', lineHeight: '1.4em',
whiteSpace: 'pre', whiteSpace: 'pre',
tabSize: 4, tabSize: 4,
overflowX: 'scroll',
'@media': { '@media': {
'screen and (min-width: 768px)': { 'screen and (min-width: 768px)': {
fontSize: '1.1em', fontSize: '1.1em',

View file

@ -10,7 +10,7 @@ export default function Text({ language, text }: { language: string, text: strin
const media_matcher = window.matchMedia('(prefers-color-scheme: light)'); const media_matcher = window.matchMedia('(prefers-color-scheme: light)');
const [light_theme, set_light_theme] = useState(media_matcher.matches); const [light_theme, set_light_theme] = useState(media_matcher.matches);
function check_light_theme(event) { function check_light_theme(event: MediaQueryListEvent) {
if (light_theme != event.matches) { if (light_theme != event.matches) {
set_light_theme(!light_theme); set_light_theme(!light_theme);
} }
@ -30,7 +30,7 @@ export default function Text({ language, text }: { language: string, text: strin
code={text} code={text}
language={language} language={language}
> >
{({ className, style, tokens, getLineProps, getTokenProps }) => ( {({ tokens, getLineProps, getTokenProps }) => (
<div> <div>
{tokens.map((line, i) => ( {tokens.map((line, i) => (
<div key={i} {...getLineProps({ line })}> <div key={i} {...getLineProps({ line })}>