mirror of
https://github.com/SomboChea/ui
synced 2026-01-17 16:45:49 +07:00
fix: media query ts ignore
This commit is contained in:
@@ -8,16 +8,26 @@ export const breakpoints = {
|
||||
xlarge: 1275,
|
||||
};
|
||||
|
||||
const mq = Object.keys(breakpoints).reduce((accumulator, label) => {
|
||||
const prefix = typeof breakpoints[label] === 'string' ? '' : 'min-width:';
|
||||
const suffix = typeof breakpoints[label] === 'string' ? '' : 'px';
|
||||
accumulator[label] = cls =>
|
||||
css`
|
||||
@media (${prefix + breakpoints[label] + suffix}) {
|
||||
${cls};
|
||||
}
|
||||
`;
|
||||
return accumulator;
|
||||
}, {});
|
||||
type Sizes = keyof typeof breakpoints;
|
||||
|
||||
type MediaQuery = {
|
||||
[key in Sizes]: (cls: any) => string;
|
||||
};
|
||||
|
||||
const mq: MediaQuery = Object.keys(breakpoints).reduce(
|
||||
(accumulator, label) => {
|
||||
const prefix = typeof breakpoints[label] === 'string' ? '' : 'min-width:';
|
||||
const suffix = typeof breakpoints[label] === 'string' ? '' : 'px';
|
||||
accumulator[label] = cls =>
|
||||
css`
|
||||
@media (${prefix + breakpoints[label] + suffix}) {
|
||||
${cls};
|
||||
}
|
||||
`;
|
||||
return accumulator;
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
|
||||
{} as MediaQuery
|
||||
);
|
||||
|
||||
export default mq;
|
||||
|
||||
Reference in New Issue
Block a user