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(selectionCard): update states and spacing in selection card #2240

Merged

Conversation

samyak3009
Copy link
Collaborator

@samyak3009 samyak3009 commented Jun 14, 2024

What does this implement/fix? Explain your changes.

  • Update the focus state border color in the selection card.
  • Update the left padding inside the selection card from "12px" to "16px" in stories.
  • Added padding of 2px between title and description in left-aligned cards in stories.
  • Also added the not-allowed cursour for disabled state.

...

Does this close any currently open issues?

...

Any other comments?

...

Dependent PRs/Commits

...

Describe breaking changes, if any.

...

Checklist

Check all those that are applicable and complete.

  • Merged with latest master branch

@samyak3009 samyak3009 force-pushed the feat-selection-card-states branch from ca173cb to 14f2b26 Compare June 14, 2024 11:09
@samyak3009 samyak3009 self-assigned this Jun 14, 2024
@samyak3009 samyak3009 force-pushed the feat-selection-card-states branch 4 times, most recently from 44c5058 to 471830c Compare June 19, 2024 10:57
@@ -41,20 +41,22 @@ export const SelectionCard = (props: SelectionCardProps) => {

const classes = classNames(
{
['Selection-card']: true,
['Selection-card--selected']: selected,
['Selection-card']: !disabled,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please create a separate class for non-disabled states such as Selection-card--default. Selection-card here should act as a generic class with common css properties for both the default and disabled state.

Comment on lines 26 to 30
border-radius: var(--spacing-m);
position: relative;
cursor: not-allowed;
box-shadow: inset 0 0 0 var(--spacing-xs) var(--secondary-lighter);
transition: var(--duration--fast-01) var(--standard-productive-curve);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of repeating the css properties in both Selection-card and Selection-card--disabled please move all the common properties into one css class

Comment on lines 54 to 58
border-radius: var(--spacing-m);
position: relative;
cursor: not-allowed;
box-shadow: inset 0 0 0 var(--spacing-xs) var(--primary-lighter);
transition: var(--duration--fast-01) var(--standard-productive-curve);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please refactor this as well according to above mentioned comments.

Copy link
Collaborator

@anuradha9712 anuradha9712 left a comment

Choose a reason for hiding this comment

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

Please write a test case for click and keyboard event handler not being called for disabled state

@anuradha9712
Copy link
Collaborator

Please check the following use-cases once from design end:

  • Disabled card should not be focusable
  • Also, the card is not yet selected but still shows primary color focus ring
Screenshot 2024-06-19 at 7 27 02 PM

@anuradha9712
Copy link
Collaborator

Please check this once if we need a separate States story to display both disabled and default cards

Copy link
Collaborator

@anuradha9712 anuradha9712 left a comment

Choose a reason for hiding this comment

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

Disabled Cards should not be clickable and should not trigger onClick callback on Enter keypressed

Screenshot 2024-06-19 at 7 43 05 PM

@anuradha9712
Copy link
Collaborator

Please write a test case ensuring that user is not able to select/deselect disabled cards. Write test case for both single-select and multi-select cards.

@samyak3009 samyak3009 force-pushed the feat-selection-card-states branch 4 times, most recently from 3423c6f to a042b48 Compare June 24, 2024 13:59
Comment on lines +238 to +242
const element3 = getByTestId('Selection-card-3');
fireEvent.click(element3);
expect(element3).not.toHaveClass('Selection-card--selected');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please check this test case once as on selection of element3 it should have Selection-card--selected class present. This test contradicts with the expected behavior. Please check how this test case is passing

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@anuradha9712 element3 is a disabled card so it must not be selected if it get clicked.

Comment on lines 73 to 81
<SelectionCard
id="item1"
data-test="Selection-card-3"
disabled={true}
onClick={() => updateCardSelection('item1')}
selected={isCardSelected('item1')}
>
Single Selection Item 3
</SelectionCard>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove item1 with item3

Comment on lines 35 to 43
<SelectionCard
id="item1"
data-test="Selection-card-3"
disabled={true}
onClick={() => updateCardSelection('item1')}
selected={isCardSelected('item1')}
>
Single Selection Item 3
</SelectionCard>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove item1 with item3

@samyak3009 samyak3009 force-pushed the feat-selection-card-states branch from a042b48 to ec5e317 Compare June 25, 2024 08:13
@samyak3009 samyak3009 force-pushed the feat-selection-card-states branch from ec5e317 to 8ea2982 Compare June 25, 2024 08:14
@anuradha9712 anuradha9712 merged commit 9042910 into innovaccer:develop Jun 25, 2024
4 checks passed
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

Successfully merging this pull request may close these issues.

2 participants