dees-domtools/ts/domtools.css.breakpoints.ts

67 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-03-16 12:39:50 +00:00
import { DomTools } from './domtools.classes.domtools.js';
2020-05-27 21:15:38 +00:00
2021-11-26 15:21:11 +00:00
import { CSSResult, unsafeCSS } from 'lit';
2021-11-21 14:52:49 +00:00
2022-04-19 16:13:26 +00:00
export const desktop = 1600;
export const notebook = 1240;
2020-06-03 09:07:31 +00:00
export const tablet = 1024;
export const phablet = 600;
2020-06-01 12:30:21 +00:00
export const phone = 400;
2020-05-23 15:00:01 +00:00
2020-05-27 21:15:38 +00:00
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
2020-05-23 15:00:01 +00:00
2022-04-19 16:16:20 +00:00
export const cssForDesktop = (cssArg: CSSResult) => {
return unsafeCSS(`
@container wccToolsViewport (min-width: ${desktop}px) {
${cssArg.cssText}
}
@media (min-width: ${desktop}px) {
${cssArg.cssText}
}
`);
};
2022-04-19 16:13:26 +00:00
export const cssForNotebook = (cssArg: CSSResult) => {
return unsafeCSS(`
@container wccToolsViewport (max-width: ${notebook}px) {
${cssArg.cssText}
}
@media (max-width: ${notebook}px) {
${cssArg.cssText}
}
`);
};
2021-11-21 14:52:49 +00:00
export const cssForTablet = (cssArg: CSSResult) => {
2021-11-21 15:08:27 +00:00
return unsafeCSS(`
2022-04-14 14:42:51 +00:00
@container wccToolsViewport (max-width: ${tablet}px) {
2021-11-21 14:52:49 +00:00
${cssArg.cssText}
}
2021-11-26 16:36:00 +00:00
@media (max-width: ${tablet}px) {
2021-11-21 14:52:49 +00:00
${cssArg.cssText}
}
2021-11-21 15:08:27 +00:00
`);
2020-05-23 15:00:01 +00:00
};
2021-11-21 14:52:49 +00:00
export const cssForPhablet = (cssArg: CSSResult) => {
2021-11-21 15:08:27 +00:00
return unsafeCSS(`
2022-04-14 14:42:51 +00:00
@container wccToolsViewport (max-width: ${phablet}px) {
2021-11-21 14:52:49 +00:00
${cssArg.cssText}
}
2021-11-26 16:36:00 +00:00
@media (max-width: ${phablet}px) {
2021-11-21 14:52:49 +00:00
${cssArg.cssText}
}
2021-11-21 15:08:27 +00:00
`);
2020-05-23 15:00:01 +00:00
};
2021-11-21 14:52:49 +00:00
export const cssForPhone = (cssArg: CSSResult) => {
2021-11-21 15:08:27 +00:00
return unsafeCSS(`
2022-04-14 14:42:51 +00:00
@container wccToolsViewport (max-width: ${phone}px) {
2021-11-21 14:52:49 +00:00
${cssArg.cssText}
}
2021-11-26 16:36:00 +00:00
@media (max-width: ${phone}px) {
2021-11-21 14:52:49 +00:00
${cssArg.cssText}
}
2021-11-21 15:08:27 +00:00
`);
2020-05-23 15:00:01 +00:00
};