Comments (4)
Hi @oyeanuj, the readme is actually a mistake, it should be unitless.
Option 1, while seemingly cleaner, would not be my preferred option because I would have to add a special condition just for this key (type.baseFontSize
). My preferred option would be to just get the value like this: font-size: ${ds.get('type.baseFontSize')}px;
(used with emotion/styled-components).
Option 2: this sounds good, but if the user specifies an em
value of 1.2
for example, it then becomes hard to determine what they really want. I could implement a variation of this option: baseFontSize
is always a px
value ('20px'
) and the unit is stripped when using the fontSize
function. This one actually seems like it might be better and more clear to users. What do you think?
from design-system-utils.
@oyeanuj As an interim fix, I have updated the docs so that they are correct and I should have the improved version of this soon.
from design-system-utils.
@mrmartineau I see your points, and think your solution sounds good.
On a sidenote, FWIW, is that when using it like font-size: ${ds.get('type.baseFontSize')}px;
, I noticed myself forgetting the unit at the end everytime. While that is my fault, I think in general, all the font size functions should return the values in the same way (either always with units, or never with units, or ideally, user could specify how they want it?).
Thinking more about that in conjunction with #4, I think we could have a standard API of fontSize
(and maybe even get(type.baseFontSize)
) which always returns just the numeric value (using the default unit, but also takes in a parameter to get it in a particular unit?
from design-system-utils.
Both v0.5.0 & v0.6.0 address this issue
from design-system-utils.
Related Issues (11)
- Add type definitions
- SASS "exporting" HOT 1
- Allow for type sizes to be specified by screen size HOT 5
- Fails with create-react-app (and others) HOT 2
- Interested in combining efforts? HOT 1
- Feature Request: 'toPx' function HOT 3
- Bundling & minifying concerns HOT 7
- Difference with styled-system? HOT 2
- Add tests HOT 1
- change `type.baseFontSize` to be string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from design-system-utils.