|
111 | 111 | container: pkgname / inline-size; |
112 | 112 |
|
113 | 113 | &__name { |
114 | | - --length: 40; // default value, it should be overridden via inline styles on the element |
115 | | - --fs-ratio: 1.765; // height/width (1rem/1ch) ratio measured in the browser |
116 | | - // we take the full width of the container and divide it by the number of characters in the |
117 | | - // package name (+2 to account for the parentheses): this is the horizontal space that each |
118 | | - // character has on average; we multiply this by the fs-ratio to get the font size |
| 114 | + // package name string length; 40 is the maximum length the store backend |
| 115 | + // supports and this is just a default value, it should be overridden via inline styles on |
| 116 | + // the element |
| 117 | + --length: 40; |
| 118 | + |
| 119 | + // font size/character width (1rem/1ch) ratio, a magic number |
| 120 | + // measured in the browser |
| 121 | + --fs-width-ratio: 1.77; |
| 122 | + |
| 123 | + // we take the full width of the container (100cqw) and divide it by the number of |
| 124 | + // characters in the package name (+2 to account for the parentheses): this is the horizontal |
| 125 | + // space that each character will use on average; we multiply this by the font size/character |
| 126 | + // width ratio to get the font size |
119 | 127 | --target-font-size: calc( |
120 | | - (100cqw / (2 + var(--length))) * var(--fs-ratio) |
| 128 | + (100cqw / (2 + var(--length))) * var(--fs-width-ratio) |
121 | 129 | ); |
122 | 130 |
|
123 | | - // we limit the font size to the smallest and largest available sizes |
124 | | - --max-font-size: #{map-get($settings-text-h1-mobile, font-size)}rem; // size of the title |
125 | | - --min-font-size: #{map-get($settings-text-h5-mobile, font-size)}rem; // smallest size we allow |
| 131 | + // we limit the actual font size value to the smallest and largest heading font sizes |
| 132 | + --font-size: clamp( |
| 133 | + var(--min-font-size), |
| 134 | + var(--target-font-size), |
| 135 | + var(--max-font-size) |
| 136 | + ); |
| 137 | + --min-font-size: #{map-get($settings-text-h6-mobile, font-size)}rem; |
| 138 | + --max-font-size: #{map-get($settings-text-h1-mobile, font-size)}rem; |
126 | 139 |
|
127 | 140 | @media (min-width: $breakpoint-heading-threshold) { |
128 | | - --min-font-size: #{map-get($settings-text-h5, font-size)}rem; |
| 141 | + --min-font-size: #{map-get($settings-text-h6, font-size)}rem; |
129 | 142 | --max-font-size: #{map-get($settings-text-h1, font-size)}rem; |
130 | 143 | } |
131 | 144 |
|
132 | 145 | display: inline-block; |
133 | | - font-size: clamp( |
134 | | - var(--min-font-size), |
135 | | - var(--target-font-size), |
136 | | - var(--max-font-size) |
137 | | - ); |
| 146 | + font-size: var(--font-size); |
138 | 147 | white-space: nowrap; |
139 | 148 |
|
140 | 149 | .p-tooltip__message { |
|
0 commit comments