Skip to content

add support for 'none' BorderSizeValue to hide border#5012

Merged
devongovett merged 6 commits into
adobe:mainfrom
pr7prashant:issue-4833
Sep 18, 2023
Merged

add support for 'none' BorderSizeValue to hide border#5012
devongovett merged 6 commits into
adobe:mainfrom
pr7prashant:issue-4833

Conversation

@pr7prashant
Copy link
Copy Markdown
Contributor

@pr7prashant pr7prashant commented Sep 1, 2023

Closes #4833

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

  1. Using none as border size should display no border.
  2. When using responsive break point, both using none and omitting the break point should display no border.
// Both should display no border
<View borderEndWidth={{ base: 'none', M: 'thin' }}>...</View>
<View borderEndWidth={{M: 'thin' }}>...</View>

🧢 Your Project:

return `var(--spectrum-alias-border-size-${value})`;
return value && value !== 'none'
? `var(--spectrum-alias-border-size-${value})`
: undefined;
Copy link
Copy Markdown
Member

@snowystinger snowystinger Sep 1, 2023

Choose a reason for hiding this comment

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

this won't work, border size defaults to medium
https://jsfiddle.net/qv5kp0zr/1/
https://developer.mozilla.org/en-US/docs/Web/CSS/border-width#formal_definition

We'll need to set the returned value to 0 instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. While testing it was working for me on storybook but it is better to return 0. I've updated the PR. Thanks

@devongovett
Copy link
Copy Markdown
Member

Do we need 'none'? Isn't that equivalent to null or undefined?

@pr7prashant
Copy link
Copy Markdown
Contributor Author

Do we need 'none'? Isn't that equivalent to null or undefined?

I added none so that the users can choose to omit or explicitly specify none . Please let me know if adding none is not required. I am okay with either approach :)

@LFDanLu
Copy link
Copy Markdown
Member

LFDanLu commented Sep 15, 2023

@pr7prashant apologies about the PR highjacking, we were looking to get this in for an upcoming testing session. Still discussing amongst the team about what exact api we want here.

EDIT: we've gone back to accepting "none" as an option, I've added some tests to cover the changes. Thanks for the contribution!

@pr7prashant
Copy link
Copy Markdown
Contributor Author

@pr7prashant apologies about the PR highjacking, we were looking to get this in for an upcoming testing session. Still discussing amongst the team about what exact api we want here.

EDIT: we've gone back to accepting "none" as an option, I've added some tests to cover the changes. Thanks for the contribution!

@LFDanLu No worries and thanks for the tests :)

@devongovett devongovett merged commit 6a5394b into adobe:main Sep 18, 2023
@pr7prashant pr7prashant deleted the issue-4833 branch September 19, 2023 00:51
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.

BorderSizeValue should support 'none' to hide the border

4 participants