dasig/frontend/@dasig/components/Display.tsx
2026-01-30 19:18:45 +08:00

39 lines
1.1 KiB
TypeScript

import { type JSXElement, Match, Switch } from 'solid-js';
import '../styles/Display.sass';
interface Props {
children: JSXElement
desktop?: boolean
tablet?: boolean
mobile?: boolean
}
export default (props: Props) => {
return (
<Switch>
<Match when={props.desktop && !props.tablet && !props.mobile}>
<div class="on-desktop-only">{props.children}</div>
</Match>
<Match when={!props.desktop && props.tablet && !props.mobile}>
<div class="on-tablet-only">{props.children}</div>
</Match>
<Match when={!props.desktop && !props.tablet && props.mobile}>
<div class="on-mobile-only">{props.children}</div>
</Match>
<Match when={props.desktop && props.tablet && !props.mobile}>
<div class="on-desktop-tablet-only">{props.children}</div>
</Match>
<Match when={props.desktop && !props.tablet && props.mobile}>
<div class="on-desktop-mobile-only">{props.children}</div>
</Match>
<Match when={!props.desktop && props.tablet && props.mobile}>
<div class="on-tablet-mobile-only">{props.children}</div>
</Match>
</Switch>
)
}