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: Information highlight #2961

Closed
wants to merge 11 commits into from

Conversation

niftea
Copy link

@niftea niftea commented Oct 7, 2024

Summary

Fixes: #1175

Resolves the need for an information highlight component. Moves the existing Information Highlight out of modules/docs and into modules/react-preview.
updates the existing design of information highlight to match the most recent specs. This includes changes to increase contrast between the icon and the background and changing the link component to be a button.

Release Category

Components


Checklist

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • PR Release Notes describes additional information useful to call out in a release message or removed if not applicable
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

/modules/react-preview/information-highlight/index.tsx

Areas for Feedback? (optional)

This is one of my first times using typescript. I would love additional feedback on information-highlight/lib/Icons.tsx, there is conditional logic at the very end of the file for is a color or accent color is input for the icon and I am unsure if that was the best way to go about it.

  • Code
  • Documentation
  • Testing
  • Codemods

Screenshots or GIFs (if applicable)

Screenshots taken directly from story book component made in these changes. There are 3 prebuilt variant options: Attention, Caution, and Informational. These components have a default color scheme and icon
Screenshot 2024-10-07 at 11 32 17 AM
Screenshot 2024-10-07 at 11 32 24 AM
Screenshot 2024-10-07 at 11 32 33 AM

the user is also able to customize their information highlight
Screenshot 2024-10-07 at 11 46 50 AM

It is also possible to have components without any icon, or with just one component.
Screenshot 2024-10-07 at 11 51 07 AM

right now none of the full implementation options have no icon present, but if the reviewers feel that would be good to have I can make the updates to have a few more examples without icons

Attached photo is the testing component of the story book showing all the possible combinations of components for the prebuilt variants
Screenshot 2024-10-07 at 11 48 14 AM

Thank You Gif (optional)

thank-you-icegif

@niftea niftea changed the title Information highlight feat: Information highlight Oct 7, 2024
@niftea niftea changed the base branch from master to prerelease/minor October 7, 2024 20:50
modules/preview-react/information-highlight/lib/Icon.tsx Outdated Show resolved Hide resolved
modules/preview-react/information-highlight/lib/Icon.tsx Outdated Show resolved Hide resolved
},
};

export interface IconProps extends SystemIconProps {

Choose a reason for hiding this comment

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

I'd probably put this at the top of the file instead of dividing iconStyles and defaultIcons, but I don't know canvas' conventions on where exports should go. I suspect not in the middle though :)

Copy link
Author

Choose a reason for hiding this comment

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

I moved it to the bottom since there was another export there 😅 but if both should go to the top thats an easy move

Copy link
Contributor

@josh-bagwell josh-bagwell Oct 24, 2024

Choose a reason for hiding this comment

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

We usually like to keep our "exports"/interfaces at the top.

modules/preview-react/information-highlight/index.tsx Outdated Show resolved Hide resolved
Comment on lines +1 to +9

# Canvas Kit Information Highlight

A layout that will seperate out text or other information to make it more prominent to the user

View the [documentation for Information Highlight](https://workday.github.io/canvas-kit/?path=/docs/information-highlight-react)
on Storybook.

[> Workday Design Reference: Information Highlight](https://design.workday.com/components/)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Canvas Kit Information Highlight
A layout that will seperate out text or other information to make it more prominent to the user
View the [documentation for Information Highlight](https://workday.github.io/canvas-kit/?path=/docs/information-highlight-react)
on Storybook.
[> Workday Design Reference: Information Highlight](https://design.workday.com/components/)
# Canvas Kit Preview Information Highlight
View the [documentation for Information Highlight](https://workday.github.io/canvas-kit/?path=/docs/preview-information-highlight--docs)
on Storybook.

@@ -0,0 +1,77 @@
import * as React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

I would move this into a file named InformationHighlight within the lib folder.

export type Variant = 'emphasis' | 'caution' | 'attention';
export type Variant = 'informational' | 'caution' | 'attention';
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, was this meant to be done in updating those variants?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I know this just one hook but, we can put this hook into a folder named hooks

Copy link
Author

Choose a reason for hiding this comment

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

originally i think i did it in case there was going to be high/low emphasis options for info highlight, so it wouldnt become confusing to read. I didnt change it back, but in the specs there are emphases so i guess it worked out

@@ -0,0 +1,28 @@
import * as React from 'react';
Copy link
Contributor

@josh-bagwell josh-bagwell Oct 24, 2024

Choose a reason for hiding this comment

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

So for this, a link is the right file name for this. We should not be having a traditional button within this. It uses a ExternalHyperlink in the design and in the previous component.

Copy link
Author

Choose a reason for hiding this comment

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

updated

gridColumn: '2',
justifySelf: 'start',
color: `${cssVar(base.blackPepper400)} !important`,
fontWeight: 500, // should use system.fontWeight.bold
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be updated to the comment provided


describe('InformationHighlight', () => {
it('should render on a server without crashing', () => {
const ssrRender = () => renderToString(<InformationHighlight></InformationHighlight>);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should show text within similar to a basic example.

Copy link

cypress bot commented Oct 24, 2024

Workday/canvas-kit    Run #7943

Run Properties:  status check passed Passed #7943  •  git commit e172f4521e ℹ️: Merge cf748dc68e16b0e2cf5b5e34809e2c243aa18d9e into b7605cd0991ae1f46da537001ae6...
Project Workday/canvas-kit
Branch Review information-higlight
Run status status check passed Passed #7943
Run duration 03m 52s
Commit git commit e172f4521e ℹ️: Merge cf748dc68e16b0e2cf5b5e34809e2c243aa18d9e into b7605cd0991ae1f46da537001ae6...
Committer niftea
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 24
Tests that did not run due to a developer annotating a test with .skip  Pending 24
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1092
View all changes introduced in this branch ↗︎
UI Coverage  21.73%
  Untested elements 1644  
  Tested elements 454  
Accessibility  99.17%
  Failed rules  5 critical   5 serious   0 moderate   2 minor
  Failed elements 182  

@@ -0,0 +1,80 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

This will have to be updated to match our new mdx setup.

I would reference what is now in master to match that file setup. It will be a mdx file and a stories file.

If you have any questions, don't hesitate to ask!

Copy link
Author

Choose a reason for hiding this comment

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

done! in other pr :D

@niftea
Copy link
Author

niftea commented Oct 30, 2024

unfortunately this branch was casualty of a bad rebase, so this PR is being scraped

#3015 new pr with updated specs! it only has three variants and two emphases, but fully customizable icons

@niftea niftea closed this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants