Comments (3)
Been thinking about this as well lately. I have really enjoyed composable typography (thinking Tailwind here). What about providing a simple Text
component of some kind that simply applied classes that adjusted size, color, etc without having to export various kinds of Components (e.g. Display
, Small
, etc).
Or... really thinking outside the box here... providing a Cision-based Tailwind config that only included text classes? Adding a repo like cision/tailwind
and have it provide that config tailwind.config.js
for use in other places (e.g. RoverUI, our main app, etc).
from rover-ui.
Hey, I'm not sure how helpful this will be, but I wrote a simple Font component in a personal project.
It uses styled-system and css-in-js, so it's not a perfect match.
- We should have props that map to CSS values for at least these dimensions:
fontFamily
,fontSize
,fontWeight
,lineHeight
, andcolor
. - Some of those will need new CSS custom property definitions. We already have colors and font sizes in RoverUI's
sizing.css
andcolors.css
files, but we might want to add afonts.css
ortypography.css
file to hold the other type-specific values. - We should continue (as always) passing unmapped props down to the component's main element, for customization.
- We should let users pass in a
Tag
prop that can be an html element name or a React component. That will make it easy for a consumer to switch from inline to block by adding a prop likeTag="span"
. It also would let consumers add font styles toh1
tags, for instance, without adding wrapping divs. - If desired, we could export commonly used font styles like
P
orH1
from the same file, see line 146. I think we should only do this for commonly-understood HTML tags and font-variants.
RoverUI's code should be much simpler, since we're not trying to generate all the styles from a theme object.
The hardest part will probably be extracting the right styles from the design docs, and making sure we have good enough coverage of sizes and colors to handle a wide variety of future use cases.
- Adding things like
block
,pre
, andbreakword
as props. They just rename concepts that would be easier to understand as class name or tag overrides from the consumer. - Having too many specific named exports for things like
Headline
,DisplayMD
,DisplayLG
, because the mockups we get aren't consistent about using these font variants. They're either rarely used, or they're used with so many style overrides that they're not consistent and add no value.
from rover-ui.
Awesome. Thanks for sharing. I will take a look and use that as inspiration.
from rover-ui.
Related Issues (20)
- `InputTime` picker does not display properly in Safari when input is invalid (red highlighting) HOT 1
- Replace tk-ui AccordionList with Rover AccordionList HOT 1
- Replace styled component references with CSS modules
- Inputs are the wrong height due to assumed box-sizing: border-box
- Using custom CSS props in a file not included by postcss
- EasyTab doesn't allow readonly tab prop
- InputTime validation doesn't work with value 0 or max 0 HOT 1
- Button explicitly sets button type
- Add Form Elements (Input) HOT 1
- Components generated with hygen break pre commit hook HOT 4
- EasyPill causing ts errors in HOT 2
- RoverUI button with `circle` prop doesn't center contents HOT 1
- Buttons should be capable of ref forwarding HOT 1
- Form components: logical form HOT 1
- Add Modal Component HOT 2
- More alignment options for Tooltip HOT 1
- Tooltip a11y needs work HOT 1
- `Grid` component relies on custom props on children, which shows TS errors for consuming components HOT 1
- Fix to apply CSS selector :focus-visible in the current Button
- This area is for public issue reports only. For internal issue reports, please use Cision Jira
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 rover-ui.