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

[Feature] Expander facelift #704

Merged
merged 3 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/Expander/Expander/Expander.baseStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export const baseStyles = (theme: SuomifiTheme) => css`
background-color: ${theme.colors.whiteBase};
position: relative;
padding: 0;
border: 1px solid ${theme.colors.highlightBase};
border-radius: ${theme.radiuses.basic};
box-shadow: ${theme.shadows.panelShadow};
width: 100%;
max-width: 100%;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ exports[`Basic expander shoud match snapshot 1`] = `
background-color: hsl(0,0%,100%);
position: relative;
padding: 0;
border: 1px solid hsl(212,63%,45%);
border-radius: 2px;
box-shadow: 0 1px 2px 0 hsla(0,0%,13%,0.14),0 1px 5px 0 hsla(0,0%,13%,0.12);
width: 100%;
max-width: 100%;
}
Expand Down Expand Up @@ -196,9 +196,6 @@ exports[`Basic expander shoud match snapshot 1`] = `
height: 0;
overflow: hidden;
word-break: break-word;
-webkit-transform: scaleY(0);
-ms-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: top;
-ms-transform-origin: top;
transform-origin: top;
Expand All @@ -225,7 +222,7 @@ exports[`Basic expander shoud match snapshot 1`] = `
}

.c7.fi-expander_content--open:not(.fi-expander_content--no-padding) {
padding-top: 0;
padding-top: 10px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
Expand Down Expand Up @@ -265,7 +262,11 @@ exports[`Basic expander shoud match snapshot 1`] = `
border-radius: inherit;
}

.c3.fi-expander_title-button {
.c3:hover {
background: linear-gradient(0deg,hsl(215,100%,95%),hsl(215,100%,97%));
}

.c3 .fi-expander_title-button {
display: block;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const baseStyles = (theme: SuomifiTheme) => css`
height: 0;
overflow: hidden;
word-break: break-word;
transform: scaleY(0);
transform-origin: top;
transition: all ${`${theme.transitions.basicTime}
${theme.transitions.basicTimingFunction}`};
Expand All @@ -35,7 +34,7 @@ export const baseStyles = (theme: SuomifiTheme) => css`
animation: fi-expander_content-anim ${theme.transitions.basicTime}
${theme.transitions.basicTimingFunction} 1 forwards;
&:not(.fi-expander_content--no-padding) {
${padding(theme)('0', 'm', 'm', 'm')}
${padding(theme)('xs', 'm', 'm', 'm')}
}
}
@keyframes fi-expander_content-anim {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ exports[`Basic ExpanderContent shoud match snapshot 1`] = `
height: 0;
overflow: hidden;
word-break: break-word;
-webkit-transform: scaleY(0);
-ms-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: top;
-ms-transform-origin: top;
transform-origin: top;
Expand All @@ -81,7 +78,7 @@ exports[`Basic ExpanderContent shoud match snapshot 1`] = `
}

.c1.fi-expander_content--open:not(.fi-expander_content--no-padding) {
padding-top: 0;
padding-top: 10px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
Expand Down
20 changes: 11 additions & 9 deletions src/core/Expander/ExpanderGroup/ExpanderGroup.baseStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,35 @@ export const baseStyles = (theme: SuomifiTheme) => css`
margin-top: 0;
margin-bottom: 0;
border-radius: 0;
border-top: 1px solid ${theme.colors.depthLight1};
transition: margin ${`${theme.transitions.basicTime}
${theme.transitions.basicTimingFunction}`};

& > {
border-radius: 0;
}
&:first-child {
border-top: none;
border-radius: ${theme.radiuses.basic} ${theme.radiuses.basic} 0 0;
}
&:last-child {
/* stylelint-disable */
/* prettier-ignore */
border-radius: 0 0 ${theme.radiuses.basic} ${theme.radiuses.basic};
border-bottom-left-radius: ${theme.radiuses.basic};
border-bottom-right-radius: ${theme.radiuses.basic};
}
&.fi-expander--open {
&:not(:first-child) {
border-top: none;
}

&.fi-expander--open {
border-top: 1px solid ${theme.colors.highlightBase};
border-radius: ${theme.radiuses.basic};
& + .fi-expander {
border-top: 1px solid ${theme.colors.highlightBase};
}
&:not(:first-of-type) {
margin-top: ${theme.spacing.insetXl};
}
&:not(:last-of-type) {
margin-bottom: ${theme.spacing.insetXl};
}
& + .fi-expander {
border-top: none;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ exports[`Basic expander group should match snapshot 1`] = `
margin-top: 0;
margin-bottom: 0;
border-radius: 0;
border-top: 1px solid hsl(202,7%,80%);
-webkit-transition: margin 50ms cubic-bezier(0.28,0.84,0.42,1);
transition: margin 50ms cubic-bezier(0.28,0.84,0.42,1);
}
Expand All @@ -189,18 +188,27 @@ exports[`Basic expander group should match snapshot 1`] = `
}

.c1 > .fi-expander-group_expanders .fi-expander:first-child {
border-top: none;
border-radius: 2px 2px 0 0;
}

.c1 > .fi-expander-group_expanders .fi-expander:last-child {
border-radius: 0 0 2px 2px;
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}

.c1 > .fi-expander-group_expanders .fi-expander.fi-expander--open {
.c1 > .fi-expander-group_expanders .fi-expander:not(:first-child) {
border-top: none;
}

.c1 > .fi-expander-group_expanders .fi-expander.fi-expander--open {
border-top: 1px solid hsl(212,63%,45%);
border-radius: 2px;
}

.c1 > .fi-expander-group_expanders .fi-expander.fi-expander--open + .fi-expander {
border-top: 1px solid hsl(212,63%,45%);
}

.c1 > .fi-expander-group_expanders .fi-expander.fi-expander--open:not(:first-of-type) {
margin-top: 16px;
}
Expand All @@ -209,10 +217,6 @@ exports[`Basic expander group should match snapshot 1`] = `
margin-bottom: 16px;
}

.c1 > .fi-expander-group_expanders .fi-expander.fi-expander--open + .fi-expander {
border-top: none;
}

.c1 > .fi-expander-group_all-button {
color: hsl(0,0%,13%);
-webkit-letter-spacing: 0;
Expand Down Expand Up @@ -290,8 +294,8 @@ exports[`Basic expander group should match snapshot 1`] = `
background-color: hsl(0,0%,100%);
position: relative;
padding: 0;
border: 1px solid hsl(212,63%,45%);
border-radius: 2px;
box-shadow: 0 1px 2px 0 hsla(0,0%,13%,0.14),0 1px 5px 0 hsla(0,0%,13%,0.12);
width: 100%;
max-width: 100%;
}
Expand Down Expand Up @@ -327,9 +331,6 @@ exports[`Basic expander group should match snapshot 1`] = `
height: 0;
overflow: hidden;
word-break: break-word;
-webkit-transform: scaleY(0);
-ms-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: top;
-ms-transform-origin: top;
transform-origin: top;
Expand All @@ -356,7 +357,7 @@ exports[`Basic expander group should match snapshot 1`] = `
}

.c9.fi-expander_content--open:not(.fi-expander_content--no-padding) {
padding-top: 0;
padding-top: 10px;
padding-right: 20px;
padding-bottom: 20px;
padding-left: 20px;
Expand Down Expand Up @@ -396,7 +397,11 @@ exports[`Basic expander group should match snapshot 1`] = `
border-radius: inherit;
}

.c7.fi-expander_title-button {
.c7:hover {
background: linear-gradient(0deg,hsl(215,100%,95%),hsl(215,100%,97%));
}

.c7 .fi-expander_title-button {
display: block;
}

Expand Down
24 changes: 14 additions & 10 deletions src/core/Expander/ExpanderTitle/ExpanderTitle.baseStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ export const expanderTitleBaseStyles = (theme: SuomifiTheme) => css`
min-height: 60px;
background-color: ${theme.colors.highlightLight4};
border-radius: inherit;
padding: 17px ${theme.spacing.xxxl} 16px ${theme.spacing.m};
white-space: break-word;
word-wrap: break-word;

&.fi-expander_title {
display: block;
display: flex;
justify-content: space-between;
}
&.fi-expander_title--open {
background-color: ${theme.colors.whiteBase};
Expand All @@ -27,20 +27,19 @@ export const expanderTitleBaseStyles = (theme: SuomifiTheme) => css`

& .fi-expander_title-content {
display: inline-block;
padding: 17px ${theme.spacing.m} 16px ${theme.spacing.m};
}

& .fi-expander_title-button {
${button(theme)}
${font(theme)('bodySemiBold')}
color: ${theme.colors.highlightBase};
display: inline-block;
position: absolute;
right: 0;
top: 0;
width: 44px;
height: 44px;
padding: 12px;
margin: 13px;
display: flex;
justify-content: center;
position: relative;
align-items: flex-start;
flex: 0 0 60px;
padding-top: ${theme.spacing.m};

&:focus {
outline: 0;
Expand All @@ -52,6 +51,11 @@ export const expanderTitleBaseStyles = (theme: SuomifiTheme) => css`
${theme.focuses.absoluteFocus}
}
}

&:hover {
background: ${theme.gradients.depthSecondaryToDepthSecondaryDark1};
}

${theme.focuses.noMouseFocus}
& * {
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,19 @@ exports[`Basic ExpanderTitle shoud match snapshot 1`] = `
min-height: 60px;
background-color: hsl(212,63%,98%);
border-radius: inherit;
padding: 17px 60px 16px 20px;
white-space: break-word;
word-wrap: break-word;
}

.c1.fi-expander_title {
display: block;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}

.c1.fi-expander_title--open {
Expand All @@ -186,6 +192,7 @@ exports[`Basic ExpanderTitle shoud match snapshot 1`] = `

.c1 .fi-expander_title-content {
display: inline-block;
padding: 17px 20px 16px 20px;
}

.c1 .fi-expander_title-button {
Expand Down Expand Up @@ -219,14 +226,23 @@ exports[`Basic ExpanderTitle shoud match snapshot 1`] = `
line-height: 1.5;
font-weight: 600;
color: hsl(212,63%,45%);
display: inline-block;
position: absolute;
right: 0;
top: 0;
width: 44px;
height: 44px;
padding: 12px;
margin: 13px;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
position: relative;
-webkit-align-items: flex-start;
-webkit-box-align: flex-start;
-ms-flex-align: flex-start;
align-items: flex-start;
-webkit-flex: 0 0 60px;
-ms-flex: 0 0 60px;
flex: 0 0 60px;
padding-top: 20px;
}

.c1 .fi-expander_title-button:focus {
Expand All @@ -253,6 +269,10 @@ exports[`Basic ExpanderTitle shoud match snapshot 1`] = `
z-index: 9999;
}

.c1 .fi-expander_title-button:hover {
background: linear-gradient(0deg,hsl(215,100%,95%),hsl(215,100%,97%));
}

.c1 .fi-expander_title-button:not(:focus-visible) {
outline: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export const expanderTitleButtonBaseStyles = (theme: SuomifiTheme) => css`
background-color: ${theme.colors.highlightLight4};
border-radius: inherit;

&.fi-expander_title-button {
&:hover {
background: ${theme.gradients.depthSecondaryToDepthSecondaryDark1};
}

& .fi-expander_title-button {
display: block;
}
&.fi-expander_title-button--open {
Expand Down Expand Up @@ -41,6 +45,7 @@ export const expanderTitleButtonBaseStyles = (theme: SuomifiTheme) => css`
${theme.focuses.absoluteFocus}
}
}

${theme.focuses.noMouseFocus}
& * {
cursor: pointer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ exports[`Basic ExpanderTitleButton shoud match snapshot 1`] = `
border-radius: inherit;
}

.c1.fi-expander_title-button {
.c1:hover {
background: linear-gradient(0deg,hsl(215,100%,95%),hsl(215,100%,97%));
}

.c1 .fi-expander_title-button {
display: block;
}

Expand Down