Skip to content

Allow atoms function in css prop #291

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

Mad-Kat
Copy link
Contributor

@Mad-Kat Mad-Kat commented Mar 16, 2025

This closes #290

Completing this PR will add the possibility to use atoms directly in the css prop. E.g.

<div
  css={atoms('flex gap-4', isSomething ? 'basis-8/12' : 'w-full')}
/>

Copy link

changeset-bot bot commented Mar 16, 2025

🦋 Changeset detected

Latest commit: d96fa36

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
next-yak Patch
yak-swc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Mad-Kat Mad-Kat force-pushed the feature/atoms-in-css-prop branch from 1f353d6 to d96fa36 Compare March 16, 2025 13:46
@Mad-Kat Mad-Kat marked this pull request as ready for review March 16, 2025 13:50
@Mad-Kat Mad-Kat requested a review from jantimon March 16, 2025 13:51
@jantimon jantimon requested a review from Copilot April 8, 2025 11:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 13 changed files in this pull request and generated 1 comment.

Files not reviewed (4)
  • packages/docs/content/docs/features.mdx: Language not supported
  • packages/example/app/global.css: Language not supported
  • packages/yak-swc/yak_swc/tests/fixture/css-prop-invalid/output.dev.stderr: Language not supported
  • packages/yak-swc/yak_swc/tests/fixture/css-prop-invalid/output.prod.stderr: Language not supported

if let Callee::Expr(callee) = &call_expr.callee {
if let Expr::Ident(ident) = &**callee {
// If it looks like an atoms function call based on the name, handle it differently
if ident.sym.as_ref() == "atoms" {
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding the string 'atoms' for function identification may fail if the atoms function is imported using an alias; consider using yak_imports.get_yak_library_name_for_ident(&ident.to_id()) to make the check more robust.

Suggested change
if ident.sym.as_ref() == "atoms" {
if yak_imports.get_yak_library_name_for_ident(&ident.to_id()) == "atoms" {

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Supporting twin.macro-like props?
1 participant