Skip to content

Explicit styled primitives #748

@msereniti

Description

@msereniti

Our styling works extremely unobvious. It's better explained here: https://github.com/semrush/intergalactic/blob/master/CONTRIBUTING.md#implicit-code-transformations

I propose to very change it and make it work the way same to way css modules works.

In my propose we will import css as following:

import { SLabel, SItem } from './filename.component.css'.

I also propose to add unplugin (universal plugin for all kinds of bundlers) that will transform compoennts.css file into .tsx file with React components SLabel, SItem and so on, that also imports a virtual css file.

The virtual css file should contain hashed class names (like with css modules). If classed, described in .component.css file has attribute selectors, the attribute selectors also are used to generate new css classed that are going to be applied to generated components when corresponding prop is provided. If css class uses css variables the generated component should also accept it via prop, while css variable name should be hashed for isolation.

The unplugin should support filtering variable names to allow us work with existing design tokens (named as --intergalactic-*)

New year is coming, it's better to publish major release after it.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions