@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
12 lines (11 loc) • 437 B
JavaScript
import { fontWeightTokens } from './font-weight-tokens';
export function findFontWeightTokenForValue(fontWeight, tokens = fontWeightTokens) {
if (fontWeight === 'normal') {
fontWeight = '400';
}
// Match bold and 700 to 653 to match with bold weight refreshed typography
if (fontWeight === 'bold' || fontWeight === '700') {
fontWeight = '653';
}
return tokens.find(token => token.values.fontWeight === fontWeight);
}