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

feat: Add CSS styling function #2273

Merged
merged 23 commits into from
Oct 17, 2023

Conversation

NicholasBoll
Copy link
Member

@NicholasBoll NicholasBoll commented Jun 28, 2023

Summary

Implements: #2208
Related: #1854

Discussion: #2265

This change adds a styling function to use CSS-in-JS with a minimum developer runtime and a transform process that can turn CSS-in-JS into static styling.

Release Category

Components

Release Note

This change introduces an intermediate step towards static styling. The style function takes in statically analyzable style definitions with modifiers, variables, and static styles to create styling to be used in components. It can later be interpreted at build time to create CSS packages.


Checklist

  • MDX documentation adheres to Canvas Kit's standard MDX template
  • Label ready for review has been added to PR

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)

Where Should the Reviewer Start?

Areas for Feedback? (optional)

  • Code
  • Documentation
  • Testing
  • Codemods

Testing Manually

Screenshots or GIFs (if applicable)

Thank You Gif

Emotional Damage Meme

@NicholasBoll NicholasBoll changed the title feat: Add static css function feat: Add CSS styling function and parser Sep 21, 2023
@cypress
Copy link

cypress bot commented Oct 11, 2023

1 flaky test on run #6309 ↗︎

0 937 2 0 Flakiness 1

Details:

Merge 52d65d7 into 8f76330...
Project: canvas-kit Commit: 73a406df82 ℹ️
Status: Passed Duration: 08:24 💡
Started: Oct 17, 2023 9:35 PM Ended: Oct 17, 2023 9:43 PM
Flakiness  cypress/integration/Autocomplete.spec.ts • 1 flaky test

View Output Video

Test Artifacts
... > when a value is entered > when down arrow key is pressed > when the user presses the enter key > when the use hits the "2" key > should change the filtered results Output Screenshots Video

Review all test suite changes for PR #2273 ↗︎

@NicholasBoll NicholasBoll changed the title feat: Add CSS styling function and parser feat: Add CSS styling function Oct 12, 2023
@NicholasBoll NicholasBoll added the ready for review Code is ready for review label Oct 12, 2023
@NicholasBoll NicholasBoll marked this pull request as ready for review October 13, 2023 15:35
.replace(/[^\w\s-]/g, '')
.replace(/[\s_-]+/g, '-')
.replace(/([A-Z])/g, m => {
return '-' + m.toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

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

was this to fix an issue with tabs?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. It was something I noticed when converting camelCase to dash-case.

Copy link
Member Author

Choose a reason for hiding this comment

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

For example: borderRadius became borderradius instead of border-radius


## What is this?

Canvas Kit Styling is two things:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we should link out to the discussion of the future of css and why we built this?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah it seems like this is built BECAUSE we want to better support theming/ and styling and move away from emotion

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm adding a "Why" section with a link to the discussion.


## Production

If you wish to use the static compilation, you must use the `@workday/canvas-kit-styling-parser`
Copy link
Contributor

Choose a reason for hiding this comment

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

is this still part of this PR? the parser?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not part of this PR, but another PR will add it. It is difficult to maintain 2 separate PRs and fix this type of thing. I'd rather leave this alone for now.

return convertProperty(obj);
}

export type CS = string | Record<string, string>;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to stay as CS or CreateStyles?

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, i think I'm confusing createStyles with cs

Copy link
Contributor

@mannycarrera4 mannycarrera4 left a comment

Choose a reason for hiding this comment

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

EMOTIONAL DAMAGE

@mannycarrera4 mannycarrera4 removed the ready for review Code is ready for review label Oct 17, 2023
@alanbsmith alanbsmith merged commit aa04f7e into Workday:prerelease/major Oct 17, 2023
12 checks passed
@NicholasBoll NicholasBoll deleted the feat/static-css branch January 17, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants