fix(core): update
This commit is contained in:
parent
e63cb9669b
commit
9869b0c6aa
@ -8,21 +8,24 @@ export const phone = 340;
|
|||||||
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
export type TViewport = 'native' | 'desktop' | 'tablet' | 'phablet' | 'phone';
|
||||||
|
|
||||||
export const getEnvironment = async (): Promise<TViewport> => {
|
export const getEnvironment = async (): Promise<TViewport> => {
|
||||||
const domToolsInstance = await DomTools.setupDomTools();
|
if (globalThis.deesDomTools && globalThis.deesDomTools.domToolsStatePart.getState().virtualViewport) {
|
||||||
return domToolsInstance.domToolsStatePart.getState().virtualViewport;
|
return globalThis.deesDomTools.domToolsStatePart.getState().virtualViewport;
|
||||||
|
} else {
|
||||||
|
return 'native';
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const cssForTablet = async contentArg => {
|
export const cssForTablet = async (contentArg) => {
|
||||||
if ((await getEnvironment()) === 'native' || (await getEnvironment()) === 'desktop') {
|
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||||
return `
|
return `
|
||||||
@media (max-width: ${tablet}px) {
|
@media (max-width: ${tablet}px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
} else if (
|
} else if (
|
||||||
(await getEnvironment()) === 'tablet' ||
|
getEnvironment() === 'tablet' ||
|
||||||
(await getEnvironment()) === 'phablet' ||
|
getEnvironment() === 'phablet' ||
|
||||||
(await getEnvironment()) === 'phone'
|
getEnvironment() === 'phone'
|
||||||
) {
|
) {
|
||||||
return `
|
return `
|
||||||
@media (min-width: 0px) {
|
@media (min-width: 0px) {
|
||||||
@ -32,14 +35,14 @@ export const cssForTablet = async contentArg => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const cssForPhablet = async contentArg => {
|
export const cssForPhablet = async (contentArg) => {
|
||||||
if ((await getEnvironment()) === 'native' || (await getEnvironment()) === 'desktop') {
|
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||||
return `
|
return `
|
||||||
@media (max-width: ${phablet}px) {
|
@media (max-width: ${phablet}px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
} else if ((await getEnvironment()) === 'phablet' || (await getEnvironment()) === 'phone') {
|
} else if (getEnvironment() === 'phablet' || getEnvironment() === 'phone') {
|
||||||
return `
|
return `
|
||||||
@media (min-width: 0px) {
|
@media (min-width: 0px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
@ -48,14 +51,14 @@ export const cssForPhablet = async contentArg => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const cssForPhone = async contentArg => {
|
export const cssForPhone = async (contentArg) => {
|
||||||
if ((await getEnvironment()) === 'native' || (await getEnvironment()) === 'desktop') {
|
if (getEnvironment() === 'native' || getEnvironment() === 'desktop') {
|
||||||
return `
|
return `
|
||||||
@media (max-width: ${phone}px) {
|
@media (max-width: ${phone}px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
} else if ((await getEnvironment()) === 'phone') {
|
} else if (getEnvironment() === 'phone') {
|
||||||
return `
|
return `
|
||||||
@media (min-width: 0px) {
|
@media (min-width: 0px) {
|
||||||
${contentArg}
|
${contentArg}
|
||||||
|
Loading…
Reference in New Issue
Block a user