Skip to content

Add values for all border corners #10

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

Merged
merged 3 commits into from
Nov 12, 2021
Merged

Add values for all border corners #10

merged 3 commits into from
Nov 12, 2021

Conversation

mrkldshv
Copy link
Contributor

@mrkldshv mrkldshv commented Oct 14, 2021

Fixes #7.

Screenshot:
Screen Shot 2021-10-14 at 21 09 11


if (!topLeft || !topRight || !bottomRight || !bottomLeft) {
return undefined;
}

Choose a reason for hiding this comment

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

hello! I am not sure if it's okay for anyone to comment on PR's? if it's not, I'm sorry 😔

just an ideia: maybe it would be nice to support elements that do not have all the corners rounded.
example: border-radius: 10px 10px 0 0 (only top borders are rounded).
I believe this would be the default behaviour for browsers that can get the full border-radius string.

and, if there are no borders at all, we return undefined. what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's absolutely welcomed for anyone to comment! Thanks for point this out, too.

I agree that we should allow any subset of sides to have a border radius. I can specifically think of examples like the start and ends of "button groups" that might want smaller/larger radiuses on the outer sides than the inners, or things like partially-rounded shapes (a square with one rounded corner, for example).

This code can just default to 0 for corners that don't have a defined radius value, and that should cover it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the comments! I was thinking about this use case as well, but wasn't sure if we should default it to 0. Will fix it!

Copy link
Collaborator

@faultyserver faultyserver left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this!

I agree with the comment above; once that's resolved, I think this looks good and pretty much ready to go.


if (!topLeft || !topRight || !bottomRight || !bottomLeft) {
return undefined;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's absolutely welcomed for anyone to comment! Thanks for point this out, too.

I agree that we should allow any subset of sides to have a border radius. I can specifically think of examples like the start and ends of "button groups" that might want smaller/larger radiuses on the outer sides than the inners, or things like partially-rounded shapes (a square with one rounded corner, for example).

This code can just default to 0 for corners that don't have a defined radius value, and that should cover it.

@mrkldshv mrkldshv requested a review from faultyserver October 19, 2021 07:47
Copy link
Collaborator

@faultyserver faultyserver left a comment

Choose a reason for hiding this comment

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

Sorry this took so long to get to. One quick note and then I'll be ready to merge very soon.

@@ -24,6 +24,10 @@ function setActiveRingContextManager(manager: FocusRingContextManager) {
}
}

function parseBorderRadius(radius: string) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this function is called with an optional property chain (styles[0]?.property), this could actually be an undefined value, so radius: string | undefined. I'd leave it in the long-hand rather than radius?: string since the argument is still required, it may just be undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Fixed it.

@faultyserver faultyserver merged commit 2a03377 into discord:main Nov 12, 2021
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.

Adaptive border radius not working in Firefox
3 participants