-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Twin now has support for [SolidJS](https://www.solidjs.com/) When we define the solid preset like this: ```js // babel-plugin-macros.config.js module.exports = { twin: { preset: 'solid', }, } ``` Or in `package.json`: ```js // package.json "babelMacros": { "twin": { "preset": "solid" } }, ``` Twin will use the imports from [solid-styled-components](https://github.com/solidjs/solid-styled-components) - the official css-in-js library provided by the SolidJS team. Here are the conversions that happen during common styling patterns: ### `tw` prop ```js function Component() { return <div tw="block" /> } // ↓ ↓ ↓ ↓ ↓ ↓ import { styled } from "solid-styled-components"; const TwComponent = styled("div")({ "display": "block" }); function Component() { return <TwComponent data-tw="block" />; } ``` ### `css` prop ```js const Component = ({ children }) => ( <div css={[]}>{children}</div> ) // ↓ ↓ ↓ ↓ ↓ ↓ import { styled } from "solid-styled-components"; const TwComponent = styled("div")([]); const Component = ({ children }) => ( <TwComponent>{children}</TwComponent> ) ``` ### `tw.div` ```js import tw from "twin.macro" const Component = tw.div`block` // ↓ ↓ ↓ ↓ ↓ ↓ import { styled } from "solid-styled-components"; const Component = styled("div")({ "display": "block" }); ``` ### `styled.div` ```js import { styled } from "twin.macro" const Component = styled.div([]) // ↓ ↓ ↓ ↓ ↓ ↓ import { styled } from "solid-styled-components"; const Component = styled("div")([]); ``` ### More - [StackBlitz example](https://stackblitz.com/github/ben-rogerson/twin.examples/tree/master/vite-solid-typescript?file=src/App.tsx) - [SolidJS example](https://github.com/ben-rogerson/twin.examples/blob/master/vite-solid-typescript/README.md) - [solid-styled-components](https://github.com/solidjs/solid-styled-components) Related #398
- Loading branch information
1 parent
d8bd0c5
commit e438582
Showing
13 changed files
with
250 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.