Refactor card image types - #8080
Merged
Merged
Conversation
reduce the number of possible branches by two, by being explicit about mobile sizes. Derive types from data using `as const` assertion
|
Size Change: +17 B (0%) Total Size: 587 kB ℹ️ View Unchanged
|
Make the relationship between where types are used and consumed explicit
mxdvl
force-pushed
the
mxdvl/image-refactors
branch
from
June 28, 2023 14:27
77c169a to
eafd8a0
Compare
Contributor
|
LGTM! 👍 Could we possibly also add a test for getIconSizeOnDesktop? describe('getIconSizeOnDesktop', () => {
it('should return the correct icon size based on the image size', () => {
expect(getIconSizeOnDesktop('jumbo')).toBe('xlarge');
expect(getIconSizeOnDesktop('large')).toBe('large');
expect(getIconSizeOnDesktop('carousel')).toBe('large');
expect(getIconSizeOnDesktop('medium')).toBe('medium');
expect(getIconSizeOnDesktop('small')).toBe('small');
});
}); |
ParisaTork
approved these changes
Jun 29, 2023
Contributor
Author
I would generally be inclined to avoid testing private methods or what we the TypeScript compiler guarantees such as exhaustive cases. Are the Card stories not sufficient here? |
Contributor
Great point - thanks for showing me these! Card stories are more than sufficient, please go ahead and merge :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
PlayIcon, reducing the number of possible branchesImagePositionTypeandImageSizeTypetoImageWrapper, reducing ambient typesWhy?
A small step in taming entropy…
Makes the work in #8075 easier to reason about.