Skip to content

Commit 2fafadc

Browse files
committed
🚧 wip css hard grid
1 parent 278e519 commit 2fafadc

File tree

1 file changed

+14
-0
lines changed
  • packages/eds-core-react/src/components/Typography/_components

1 file changed

+14
-0
lines changed

‎packages/eds-core-react/src/components/Typography/_components/Typography.tsx‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export type StyleHeadingProps = {
77
$lineHeight: string
88
$capHeightTrim: string
99
$baselineTrim: string
10+
$offset?: number
1011
}
1112

1213
export const Typography = styled.p<StyleHeadingProps>`
@@ -18,20 +19,33 @@ export const Typography = styled.p<StyleHeadingProps>`
1819
$lineHeight,
1920
$capHeightTrim,
2021
$baselineTrim,
22+
$offset = 0,
2123
}) => css`
2224
font-family: ${$fontFamily};
2325
font-size: ${$fontSize};
2426
line-height: ${$lineHeight};
27+
--offset-equinor: 0.05em;
28+
--_offset: calc(${$offset} * 1em);
2529
2630
&::before {
2731
content: '';
2832
margin-bottom: ${$baselineTrim};
33+
/*emulate texbox-trim*/
34+
margin-bottom: calc((((1lh - 1cap) / 2) - var(--_offset, 0em)) * -1);
2935
display: table;
36+
/*use padding to round off textbox height to multiples of 4 in supported browsers */
37+
@supports (height: round(10px, 1px)) {
38+
--_rest: calc((round(up, 1cap, 4px) - 1cap) / 2);
39+
padding-top: var(--_rest);
40+
padding-bottom: var(--_rest);
41+
}
3042
}
3143
3244
&::after {
3345
content: '';
3446
margin-top: ${$capHeightTrim};
47+
/*emulate texbox-trim*/
48+
margin-top: calc((((1lh - 1cap) / 2) + var(--_offset, 0em)) * -1);
3549
display: table;
3650
}
3751
`}

0 commit comments

Comments
 (0)