Giter VIP home page Giter VIP logo

compound-design-tokens's People

Contributors

germain-gg avatar janogarcia avatar jmartinesp avatar kerryarchibald avatar nadonomy avatar pixlwave avatar richvdh avatar riotrobot avatar robintown avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

compound-design-tokens's Issues

Issues with Android tokens output

I found some issues while taking a look at the design tokens generated for Android:

Package declaration

You don't need a closing ; character after the package declaration.

Missing imports

You'll also need these missing imports:

import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight

TextStyles

The current TextStyles declarations have a few issues:

  1. It needs a comma after each parameter.
  2. lineHeight and fontWeight should use sp instead of dp.
  3. fontFamily expects a FontFamily object. If we're using plain "Roboto" we should use Family.Default instead (it'll use the system font, in this case, Roboto). If we want to use a monospace, cursive or sans serif variant there are Family.Monospace, Family.Cursive and Family.SansSerif. If we want to use a custom font we'll need to figure out how to create custom FontFamilyobjects.
  4. Also, it would be great to add some indentation to the parameter lines.

The result should look something like:

val fontBodyMdRegular = TextStyle(
    fontFamily = FontFamily.Default,
    fontWeight = FontWeight.W400,
    lineHeight = 20.sp,
    fontSize = 14.sp,
    letterSpacing = 0.017857.em,
)

Size multipliers

I've seen that some sizes have: val space0_5X = 4.dp * 0.5. The {number}.dp expression generates a Dp object containing a Float value. In Kotlin, 1 can be used to multiply a Float, but 0.5 can't (it's recognised as a Double instead). To make these multipliers work with any number, instead of * 0.5 or * 2, it should be * 0.5f and * 2f, i.e:

val space1_5X = 4.dp * 1.5f
val space20X = 4.dp * 20f

Initial Swift integration feedback

Some points from my first pass at integrating main into ElementX iOS:

  • The colorsets all seem to have an alpha of 0.0039 (sorry I totally missed this on the PR).
  • The Swift files need to import SwiftUI instead of import UIKit to compile using Color values.
  • As this is a package the Color initialisers need a bundle parameter to find the asset (again, sorry I missed this on the PR): Color("colorPink1400", bundle: Bundle.module)

Minor:

  • Something that I only recently twigged about is that you could replace all the CGFloat(12) values with 12.0 if it makes life easier/tidier as the Swift compiler now automatically converts a Double into a CGFloat. The multiplications are fine to remain as mySpaceDouble * 2, thats still valid.

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.