Giter Site home page Giter Site logo

Comments (4)

mrmartineau avatar mrmartineau commented on May 26, 2024 1

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.

mrmartineau avatar mrmartineau commented on May 26, 2024 1

@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.

oyeanuj avatar oyeanuj commented on May 26, 2024

@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.

mrmartineau avatar mrmartineau commented on May 26, 2024

Both v0.5.0 & v0.6.0 address this issue

from design-system-utils.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.