Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Provide a global css tagged template literal function for better IDE DX #1422

Open
alexilyaev opened this issue Jan 7, 2024 · 0 comments

Comments

@alexilyaev
Copy link

alexilyaev commented Jan 7, 2024

EDIT: Sorry, didn't realize Feature Requests should go in Discussions 🙏🏼
#1423

Based on the example in TIPS.md > Adjust the CSS of Choices

Expand code...
import "@johnlindquist/kit"

let choice = await arg({
  css: `
.light-purple {
  background-color: #c8a2c8;
}  
.medium-purple {
  background-color: #967bb6;
}
.dark-purple {
  background-color: #5d4777;
}

.focused {
  box-shadow: inset .5rem 0 0 0 #ffffffee;
}
  `,
  placeholder: "Choose a shade of purple",
  choices: [
    { name: "[L]ight Purple", value: "light-purple", className: "light-purple", focusedClassName: "focused" },
    { name: "[M]edium Purple", value: "medium-purple", className: "medium-purple", focusedClassName: "focused" },
    { name: "[D]ark Purple", value: "dark-purple", className: "dark-purple", focusedClassName: "focused" },
  ],
})

await div(md(`You chose ${choice}`))

The CSS code is just a plain string in VS Code:

image

By adding a css tagged template literal function, we could leverage existing IDE tools like syntax highlighting, Emmet completion, Prettier formatting and CSS intellisense via, e.g. vscode-styled-components extension:

image image
@alexilyaev alexilyaev changed the title [Feature] Provide a global css tagged template literal function [Feature] Provide a global css tagged template literal function for better IDE DX Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant