Skip to content

Commit

Permalink
Add breakpoints, fix CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro committed Apr 3, 2024
1 parent 9c9c486 commit 06779dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ export default {
...(process.env.NODE_ENV === "production" ? [cssnano] : []),
],
};

10 changes: 7 additions & 3 deletions src/style/fluidSizeTS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const cssUnitMult = (value: string, multiplier: number) =>
`${parseFloat(value) * multiplier}${getUnit(value)}`;

const scalingMap = [
[0, 0.3],
[200, 0.3],
[380, 0.65],
[500, 0.8],
[720, 0.9],
[1280, 1],
Expand Down Expand Up @@ -38,16 +39,19 @@ export const _calculateFluidProperty = (
? maxFonSize.replace(/(px|rem)/g, "")
: parseFloat(maxFonSize);

// the pxToRem plugin converts "0px" to "0", which breaks things
if (minVW == "0px") minVW = "0rem";

return `calc(${minFontSize} + (${_maxFontSize} - ${_minFontSize}) * ((100vw - ${minVW}) / ${
parseFloat(maxVW) - parseFloat(minVW)
}))`;
};

export const remBase = 16;
export const pxToEmDepr = (value: string | number) =>
parseFloat(`${value}`) / remBase + "em";
parseFloat(value.toString()) / remBase + "em";
export const pxToRemDepr = (value: string | number) =>
parseFloat(`${value}`) / remBase + "rem";
parseFloat(value.toString()) / remBase + "rem";
const pxToRemRuntime = (value: string | number) => `(${value}/${remBase}*1rem)`;

export const pxToEm = pxToEmDepr;
Expand Down

0 comments on commit 06779dd

Please sign in to comment.