Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable formatjs/no-literal-string-in-jsx */
|
||||
import copy from 'copy-to-clipboard'
|
||||
import copy from "copy-to-clipboard"
|
||||
|
||||
import { kebabify } from '../../generate/utils'
|
||||
import { kebabify } from "../../generate/utils"
|
||||
|
||||
import tableStyles from './tokens.module.css'
|
||||
import tableStyles from "./tokens.module.css"
|
||||
|
||||
type ThemeValue = {
|
||||
resolved: string | number
|
||||
@@ -24,15 +24,15 @@ function copyToClipboard(text: string) {
|
||||
function getBaseUnitMultiplier(tokenName: string): string {
|
||||
// Token names are like "Space/x0", "Space/x025", "Space/x05", "Space/x1", "Space/x15", etc.
|
||||
const match = tokenName.match(/Space\/x(\d+)/)
|
||||
if (!match) return '0x'
|
||||
if (!match) return "0x"
|
||||
|
||||
const num = match[1]
|
||||
|
||||
// Handle special cases
|
||||
if (num === '0') return '0x'
|
||||
if (num === '025') return '0.25x'
|
||||
if (num === '05') return '0.5x'
|
||||
if (num === '15') return '1.5x'
|
||||
if (num === "0") return "0x"
|
||||
if (num === "025") return "0.25x"
|
||||
if (num === "05") return "0.5x"
|
||||
if (num === "15") return "1.5x"
|
||||
|
||||
// For other numbers, they're already the multiplier (x1 = 1x, x2 = 2x, etc.)
|
||||
return `${num}x`
|
||||
@@ -42,15 +42,15 @@ export function Spacing({ theme }: SpacingProps) {
|
||||
// Filter spacing tokens
|
||||
const spacingTokens: Theme = {}
|
||||
for (const [k, v] of Object.entries(theme)) {
|
||||
if (k.startsWith('Space/')) {
|
||||
if (k.startsWith("Space/")) {
|
||||
spacingTokens[k] = v as ThemeValue
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by value
|
||||
const sortedTokens = Object.entries(spacingTokens).sort((a, b) => {
|
||||
const aValue = typeof a[1].resolved === 'number' ? a[1].resolved : 0
|
||||
const bValue = typeof b[1].resolved === 'number' ? b[1].resolved : 0
|
||||
const aValue = typeof a[1].resolved === "number" ? a[1].resolved : 0
|
||||
const bValue = typeof b[1].resolved === "number" ? b[1].resolved : 0
|
||||
return aValue - bValue
|
||||
})
|
||||
|
||||
@@ -72,7 +72,7 @@ export function Spacing({ theme }: SpacingProps) {
|
||||
</thead>
|
||||
<tbody>
|
||||
{sortedTokens.map(([k, v]) => {
|
||||
const value = typeof v.resolved === 'number' ? v.resolved : 0
|
||||
const value = typeof v.resolved === "number" ? v.resolved : 0
|
||||
const valuePx = `${value}px`
|
||||
const multiplier = getBaseUnitMultiplier(k)
|
||||
|
||||
@@ -112,7 +112,7 @@ export function Spacing({ theme }: SpacingProps) {
|
||||
className={tableStyles.visualBar}
|
||||
style={{
|
||||
width: `${value}px`,
|
||||
minWidth: value > 0 ? '2px' : '0',
|
||||
minWidth: value > 0 ? "2px" : "0",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user