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(gradient): linear gradient mixin #15081

Merged
merged 9 commits into from
Nov 7, 2023

Conversation

tw15egan
Copy link
Collaborator

@tw15egan tw15egan commented Nov 1, 2023

Closes #15074

Adds in an ai-gradient mixin (what should we call this?) that can be used to add in the AI aura linear-gradient to components. This takes in a direction and a width, with defaults of right and 50%.

To Do:

  • Get proper color tokens for gradient tokens (currently using the rgba value found in Figma kit. Do these map to existing colors?

Changelog

New

  • Demo story under unstable__LinearGradient
  • ai-gradient mixin that takes in a direction and a width
  • 3 tokens, which we can rename + add to if needed
    • ai-gradient-start-01
    • ai-gradient-start-02
    • ai-gradient-end

Testing / Reviewing

Go to unstable__linearGradient and check out the values.

Copy link

netlify bot commented Nov 1, 2023

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit 751385e
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/654a495846cdea000875821f
😎 Deploy Preview https://deploy-preview-15081--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 1, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 751385e
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/654a495846cdea000875821d
😎 Deploy Preview https://deploy-preview-15081--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@tw15egan tw15egan marked this pull request as ready for review November 3, 2023 13:05
@tw15egan tw15egan requested review from a team as code owners November 3, 2023 13:05
@tw15egan tw15egan changed the title feat(gradient): Linear gradient mixin feat(gradient): linear gradient mixin Nov 3, 2023
@tw15egan tw15egan requested a review from aagonzales November 3, 2023 13:05
@aagonzales
Copy link
Member

aagonzales commented Nov 3, 2023

Get proper color tokens for gradient tokens (currently using the rgba value found in Figma kit. Do these map to existing colors?

@tw15egan Yes, they do. Its coolGray-10, blue-10 and blue-20

image

@aagonzales
Copy link
Member

I also think the word layer in the token name is confusing with our actually layer tokens so can we just call those tokens:

  • aiGradientStart01
  • aiGradientStart02

@tw15egan
Copy link
Collaborator Author

tw15egan commented Nov 6, 2023

@aagonzales I've updated the token names and now using the color tokens directly 👍

Copy link
Member

@aagonzales aagonzales left a comment

Choose a reason for hiding this comment

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

Cool! I think this is good for now then. Refined designs of the gradient will come later.

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

Looks solid to me. I agree the ai-gradient naming seems a bit off but I'm not sure what I'd prefer more. This is experimental so it's fine for now I think.

I definitely prefer having it specific like this for now instead of just calling it gradient. We can make future name changes more specific (or less specific) whereas if we named it gradient we'd be much more locked in.

import './linear-gradient-story.scss';

export default {
title: 'Experimental/unstable__LinearGradient',
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about having this in the storybook long term. Feels more like something we should find a way to document in the Themes elements example. Not a blocker for this PR, but something to consider for the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I can remove this before we merge 👍🏻

@aagonzales
Copy link
Member

Yeah I'm struggling to think of a good name for the tokens. "aura" is another option, except that's also what the dynamic, animated element will be called to. Maybe we can call them "ai-aura-dynamic" and "ai-aura-static"?

@tw15egan tw15egan force-pushed the linear-gradient-mixin branch from 6df2660 to 16714df Compare November 7, 2023 13:57
@tw15egan tw15egan enabled auto-merge November 7, 2023 14:27
@tw15egan tw15egan added this pull request to the merge queue Nov 7, 2023
Merged via the queue into carbon-design-system:main with commit 5b6ba55 Nov 7, 2023
14 checks passed
@tw15egan tw15egan deleted the linear-gradient-mixin branch November 7, 2023 15:28
Copy link
Member

@mattrosno mattrosno left a comment

Choose a reason for hiding this comment

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

@tw15egan @aagonzales @tay1orjones I understand this has been approved and merged, but here's my 2-cents on naming convention and why it could be beneficial to not use "AI" in any of our token / mixin / component naming.


/// Experimental - name and structure subject to change. Use at your own risk!
/// Adds AI gradient styles to a component
/// @access public
Copy link
Member

Choose a reason for hiding this comment

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

Should @access private be used for experimental? If it's public, then it's part of our public API as supported.

http://sassdoc.com/annotations/#access

/// @example @include focus-outline('outline');
/// @group utilities

@mixin ai-gradient($direction: 'right', $width: 50%) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm also questioning our use of ai- in token and mixin naming. Following the token naming convention shown here, would we want to go with gradient-01?

This could be more future proof. What happens when everything is "AI". We don't want our code base littered with ai prefixes/namespaces. A few years from now, that will seem silly.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah @tay1orjones has mentioned the same thing about the "ai" term. We haven't finalized the token name yet just launching something so TJ isn't blocked for the next implementation steps. I think we were going to try and avoid "gradient" as well since that's not scalable (could evolve to something other than a linear gradient). I was thinking it could just be a flavor of "aura" (like aura-static) or whatever we end up calling that in the AI world.

danoro96 pushed a commit to danoro96/carbon that referenced this pull request Jan 18, 2024
* feat(gradient): add linear gradient mixin

* feat(gradient): add gradient tokens, update demo story

* fix(gradient): change default direction

* chore(snapshot): update snapshots

* refactor(Gradient): use color tokens, update token names

* test(snapshot): update snapshots

* docs(ai-gradient): mark mixin experimental, update year

* chore(storybook): remove test story
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.

C4AI Gradient: Implement gradient in element and style packages
5 participants