@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
15 lines (14 loc) • 537 B
JavaScript
import { fontWeightTokens } from './font-weight-tokens';
export function findFontWeightTokenForValue(fontWeight) {
var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 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(function (token) {
return token.values.fontWeight === fontWeight;
});
}