Skip to content

Commit

Permalink
fix(KpiBlock): update style when there is no variation (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
sun-tea authored and Thomas Roux committed Apr 2, 2019
1 parent b512cca commit 6916641
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
17 changes: 4 additions & 13 deletions src/KpiBlock/__tests__/__snapshots__/KpiBlock.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ exports[`<KpiBlock /> should render with a negative variation value 1`] = `
}
.c0 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
background: hsl(0,100%,100%);
border: 1px solid hsl(207,22%,90%);
border-radius: 0.4rem;
Expand Down Expand Up @@ -145,10 +142,7 @@ exports[`<KpiBlock /> should render with a positive variation value 1`] = `
}
.c0 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
background: hsl(0,100%,100%);
border: 1px solid hsl(207,22%,90%);
border-radius: 0.4rem;
Expand Down Expand Up @@ -223,10 +217,7 @@ exports[`<KpiBlock /> should render without a problem 1`] = `
}
.c0 {
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
text-align: center;
background: hsl(0,100%,100%);
border: 1px solid hsl(207,22%,90%);
border-radius: 0.4rem;
Expand All @@ -235,7 +226,7 @@ exports[`<KpiBlock /> should render without a problem 1`] = `
display: grid;
grid-template-areas: 'variation' 'value' 'title';
height: 10rem;
grid-template-rows: max-content max-content max-content;
grid-template-rows: auto max-content;
padding: 1rem;
position: relative;
}
Expand Down
5 changes: 3 additions & 2 deletions src/KpiBlock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ KpiBlock.defaultProps = {
};

export default styled(KpiBlock)`
align-items: center;
text-align: center;
background: ${({ theme: { palette } }) => palette.white};
border: 1px solid ${({ theme: { palette } }) => palette.lightGrey};
border-radius: ${({ theme: { dimensions } }) => dimensions.radius};
Expand All @@ -75,7 +75,8 @@ export default styled(KpiBlock)`
${({ isCompacted }) =>
!isCompacted &&
css`
grid-template-rows: max-content max-content max-content;
grid-template-rows: ${({ variation }) =>
variation ? 'max-content max-content max-content' : 'auto max-content'};
`};
padding: ${({ isCompacted }) => (isCompacted ? '1.2rem' : '1rem')};
Expand Down

0 comments on commit 6916641

Please sign in to comment.