Skip to content

Commit

Permalink
fix: prevent OakIcon from shrinking when in a flex context
Browse files Browse the repository at this point in the history
we'll always want precise control over the dimensions of the icon, so we'll
use min-width and min-height to prevent it from shrinking when in a flex container
  • Loading branch information
carlmw committed Mar 15, 2024
1 parent c0105b2 commit 4b5f06a
Show file tree
Hide file tree
Showing 25 changed files with 80 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/atoms/OakIcon/OakIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const OakIcon = (props: OakIconProps) => {
alt={alt ?? iconName}
$width={$width}
$height={$height}
$minHeight={$width}
$minWidth={$height}
placeholder="empty"
// Icons should not be optimised since the SVG is already as small as it can be and should be served directly
unoptimized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ exports[`OakIcon matches snapshot 1`] = `
.c0 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ exports[`InternalShadowRectButton matches snapshot 1`] = `
.c7 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ exports[`InternalShadowRoundButton matches snapshot 1`] = `
.c9 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ exports[`OakBackLink matches snapshot 1`] = `
.c1 {
position: relative;
width: 2.5rem;
min-width: 2.5rem;
height: 2.5rem;
min-height: 2.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ exports[`OakCheckBox matches snapshot 1`] = `
.c10 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ exports[`OakDragAndDropInstructions matches snapshot 1`] = `
.c3 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ exports[`OakDraggable matches snapshot 1`] = `
.c5 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ exports[`OakDraggableFeedback matches snapshot 1`] = `
.c5 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ exports[`OakHandDrawnCardWithIcon matches snapshot 1`] = `
.c6 {
position: relative;
width: 4rem;
min-width: 4rem;
height: 4rem;
min-height: 4rem;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -82,12 +84,24 @@ exports[`OakHandDrawnCardWithIcon matches snapshot 1`] = `
}
}
@media (min-width:750px) {
.c6 {
min-width: 7.5rem;
}
}
@media (min-width:750px) {
.c6 {
height: 7.5rem;
}
}
@media (min-width:750px) {
.c6 {
min-height: 7.5rem;
}
}
<div
className="c0 c1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ exports[`OakLessonInfoCard component test matches snapshot 1`] = `
.c4 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ exports[`OakPrimaryButton matches snapshot 1`] = `
.c7 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ exports[`OakPrimaryInvertedButton matches snapshot 1`] = `
.c7 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ exports[`OakRoundIcon matches snapshot 1`] = `
.c1 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ exports[`OakSecondaryButton matches snapshot 1`] = `
.c7 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ exports[`OakHintButton matches snapshot 1`] = `
.c10 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ exports[`OakLessonBottomNav matches snapshot 1`] = `
.c16 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -359,7 +361,9 @@ exports[`OakLessonBottomNav matches snapshot 1`] = `
.c7 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -551,7 +555,9 @@ exports[`OakLessonBottomNav matches snapshot 1`] = `
.c7 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -761,7 +767,9 @@ exports[`OakLessonBottomNav matches snapshot 1`] = `
.c7 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ exports[`OakLessonNavItem matches snapshot 1`] = `
.c5 {
position: relative;
width: 3.5rem;
min-width: 3.5rem;
height: 3.5rem;
min-height: 3.5rem;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -66,7 +68,9 @@ exports[`OakLessonNavItem matches snapshot 1`] = `
.c14 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ exports[`OakLessonReviewItem matches snapshot 1`] = `
.c4 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ exports[`OakLessonTopNav matches snapshot 1`] = `
.c4 {
position: relative;
width: 2.5rem;
min-width: 2.5rem;
height: 2.5rem;
min-height: 2.5rem;
font-family: Lexend,sans-serif;
}
Expand All @@ -29,7 +31,9 @@ exports[`OakLessonTopNav matches snapshot 1`] = `
.c8 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ exports[`OakLessonVideoTranscript matches snapshot 1`] = `
.c11 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ exports[`OakQuizFeedback matches snapshot 1`] = `
.c3 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -118,7 +120,9 @@ exports[`OakQuizFeedback matches snapshot 1`] = `
.c3 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -236,7 +240,9 @@ exports[`OakQuizFeedback matches snapshot 1`] = `
.c3 {
position: relative;
width: 100%;
min-width: 100%;
height: 100%;
min-height: 100%;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ exports[`OakQuizHint matches snapshot 1`] = `
.c12 {
position: relative;
width: 1.5rem;
min-width: 1.5rem;
height: 1.5rem;
min-height: 1.5rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ exports[`OakQuizMatch matches snapshot 1`] = `
.c4 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -168,7 +170,9 @@ exports[`OakQuizMatch matches snapshot 1`] = `
.c9 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ exports[`OakQuizOrder matches snapshot 1`] = `
.c4 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down Expand Up @@ -168,7 +170,9 @@ exports[`OakQuizOrder matches snapshot 1`] = `
.c12 {
position: relative;
width: 2rem;
min-width: 2rem;
height: 2rem;
min-height: 2rem;
font-family: Lexend,sans-serif;
}
Expand Down

0 comments on commit 4b5f06a

Please sign in to comment.