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

Added support for portrait size ratios #6501

Merged
merged 3 commits into from Dec 1, 2022

Conversation

JustinTime42
Copy link
Contributor

Regarding this issue: #6495, suggesting allowing ratios above 100% of the width to allow for portrait style presentation.

Currently, in the toPercent() function, any number above 1 converts to a percent, ensuring that width is always greater than or equal to height. Perhaps, for small numbers above 1 we could infer that the developer wants a portrait style layout. I've suggested 5 somewhat arbitrarily, but it seems absurdly small for a percent height/width ratio so seems safe to me. Suggestions?

src/Ratio.tsx Outdated
@@ -38,7 +38,7 @@ const defaultProps = {

function toPercent(num: number): string {
if (num <= 0 || num > 100) return '100%';
if (num < 1) return `${num * 100}%`;
if (num < 5) return `${num * 100}%`;
Copy link
Member

Choose a reason for hiding this comment

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

It's better to remove the upper limit of 100 in the line above so users can specify 200 as the value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah of course - Thanks!
I've committed your suggestion with a change to tests to allow the taller aspect ratio.

@kyletsang kyletsang merged commit 3cfdab1 into react-bootstrap:master Dec 1, 2022
@kyletsang
Copy link
Member

Thanks!

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.

None yet

2 participants