Added display component

This commit is contained in:
Patrick Alvin Alcala 2025-09-16 10:01:51 +08:00
parent f22261fff3
commit 4de57fcb4a
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,41 @@
import '../styles/Viewport.sass'
import { type JSXElement, Switch, Match } from 'solid-js'
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>
</>
)
}

View file

@ -12,6 +12,7 @@ export { default as Logo } from './components/Logo'
export { default as Navbar } from './components/Navbar'
export { default as Page } from './components/Page'
export { default as Row } from './components/Row'
export { default as Display } from './components/Display'
export { default as OptimizeBackground } from './Optimizers/OptimizeBackground'
export { default as OptimizeImage } from './Optimizers/OptimizeImage'

1
fwt/styles/Viewport.sass Normal file
View file

@ -0,0 +1 @@
@use '/src/styles/classes.sass'