@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
15 lines • 576 B
JavaScript
import { typographyValueToToken } from './typography-value-to-token';
export function findTypographyTokenForValues(fontSize, lineHeight) {
// Match 11px to 12px as this is what happened when transitioning from legacy to refreshed typography
if (fontSize === '11px') {
fontSize = '12px';
}
var matchingTokens = typographyValueToToken.filter(function (token) {
return token.values.fontSize === fontSize;
})
// If lineHeight == 1, we don't match to a token
.filter(function () {
return lineHeight === '1' ? false : true;
});
return matchingTokens;
}