Skip to content

Commit

Permalink
fix: spacingskala-eksempel
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Mar 30, 2022
1 parent d10838b commit b415d77
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/core/documentation/Spacing/Spacing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ const SpacingTableRow: React.FC<{ spacing: spacingClass }> = ({ spacing }) => {
};
const baseFontSize = 16; // 1rem = 16px
const remValue = pxValue !== "N/A" ? parseInt(pxValue) / baseFontSize : pxValue;

// Bruker ikke useBrowserPreferences her pga sirkulær avhengighet. Ikke følg dette eksempelet!
const forcedColors = window && window.matchMedia ? window.matchMedia("(forced-colors: active)").matches : false;

return (
<tr className="jkl-portal-spacing-example-table__row">
<td data-header="Spacing:" className="jkl-portal-spacing-example-table__data">
<div className={`jkl-${spacing}--top`} style={{ display: "none" }} ref={ref} />
<div
aria-label={`${spacing}, ${pxValue}`}
style={{ backgroundColor: "currentColor", width: `${remValue}rem`, height: `${remValue}rem` }}
style={{
backgroundColor: forcedColors ? "CanvasText" : "currentColor",
width: `${remValue}rem`,
height: `${remValue}rem`,
}}
/>
</td>
<td data-header="Variabel:" className="jkl-portal-spacing-example-table__data">
Expand Down

0 comments on commit b415d77

Please sign in to comment.