feat(mobile): add CSS rules to switch shells based on data-form-factor + viewport
This commit is contained in:
@@ -127,3 +127,32 @@
|
||||
@apply bg-muted-foreground/30;
|
||||
}
|
||||
}
|
||||
|
||||
/* ─── Form-factor shell visibility ──────────────────────────────────────────
|
||||
* Two shells (desktop + mobile) render to the DOM on every page; CSS reveals
|
||||
* one and hides the other. The data-form-factor body attribute is set
|
||||
* server-side from User-Agent (see src/lib/form-factor.ts). The media-query
|
||||
* fallback handles desktop browsers resized below lg (1024px), or stripped UAs.
|
||||
*/
|
||||
[data-shell='desktop'] {
|
||||
display: block;
|
||||
}
|
||||
[data-shell='mobile'] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 1023.98px) {
|
||||
[data-shell='desktop'] {
|
||||
display: none;
|
||||
}
|
||||
[data-shell='mobile'] {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
body[data-form-factor='mobile'] [data-shell='desktop'] {
|
||||
display: none;
|
||||
}
|
||||
body[data-form-factor='mobile'] [data-shell='mobile'] {
|
||||
display: block;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user