mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-05-18 06:24:22 +02:00
fix(flex): respect DesktopOnly and MobileOnly components
This commit is contained in:
parent
e98d97a271
commit
2e1f7df7e6
@ -21,9 +21,13 @@ export default ((config: FlexConfig) => {
|
|||||||
const direction = config.direction ?? "row"
|
const direction = config.direction ?? "row"
|
||||||
const wrap = config.wrap ?? "nowrap"
|
const wrap = config.wrap ?? "nowrap"
|
||||||
const gap = config.gap ?? "1rem"
|
const gap = config.gap ?? "1rem"
|
||||||
|
const displayClass = `${props.displayClass ?? ""} flex-component`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={`display: flex; flex-direction: ${direction}; flex-wrap: ${wrap}; gap: ${gap};`}>
|
<div
|
||||||
|
class={`${displayClass}`}
|
||||||
|
style={`flex-direction: ${direction}; flex-wrap: ${wrap}; gap: ${gap};`}
|
||||||
|
>
|
||||||
{config.components.map((c) => {
|
{config.components.map((c) => {
|
||||||
const grow = c.grow ? 1 : 0
|
const grow = c.grow ? 1 : 0
|
||||||
const shrink = (c.shrink ?? true) ? 1 : 0
|
const shrink = (c.shrink ?? true) ? 1 : 0
|
||||||
|
@ -123,16 +123,32 @@ a {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex-component {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.desktop-only {
|
.desktop-only {
|
||||||
display: initial;
|
display: initial;
|
||||||
|
&.flex-component {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
@media all and ($mobile) {
|
@media all and ($mobile) {
|
||||||
|
&.flex-component {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-only {
|
.mobile-only {
|
||||||
display: none;
|
display: none;
|
||||||
|
&.flex-component {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@media all and ($mobile) {
|
@media all and ($mobile) {
|
||||||
|
&.flex-component {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
display: initial;
|
display: initial;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user