element-hq / compound-design-tokens Goto Github PK
View Code? Open in Web Editor NEWCompound design tokens
License: Apache License 2.0
Compound design tokens
License: Apache License 2.0
I found some issues while taking a look at the design tokens generated for Android:
You don't need a closing ;
character after the package declaration.
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
The current TextStyles
declarations have a few issues:
lineHeight
and fontWeight
should use sp
instead of dp
.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 FontFamily
objects.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,
)
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
Thank you for raising an issue, you've unfortunately landed at the wrong place...
This repository is used for internal team issue tracking only.
Some points from my first pass at integrating main
into ElementX iOS:
import SwiftUI
instead of import UIKit
to compile using Color
values.Color
initialisers need a bundle parameter to find the asset (again, sorry I missed this on the PR): Color("colorPink1400", bundle: Bundle.module)
Minor:
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.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.