From b66f761a9e6bfe5dbd1475f54599d23408f25060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Moreira?= Date: Wed, 23 May 2018 12:41:40 +0100 Subject: [PATCH] #1406 - implement responsive rules on create instance (#1432) * fix(instances): swap absolute media query value for defined breakpoint * feat(ui-toolkit): update breakpoints * feat(ui-toolkit): view container padding and max width * feat(ui-toolkit): responsive image selector * fix(ui-toolkit): delay parallax header hiding * feat(instances): responsive rules for package selection * test(instances): update snapshots * fix(instances): use color variables on package card * fix(instances): import breakpoints from ui-toolkit * feat(instances): package selection for mobile or desktop version * feat(instances): remove unnecessary col css props * test(instances): update snapshots * test(instances): update resource widgets snaphots --- .../my-joy-images/src/components/summary.js | 3 +- .../__tests__/__snapshots__/menu.spec.js.snap | 22 +- .../__tests__/__snapshots__/list.spec.js.snap | 50 ++- .../__snapshots__/snapshots.spec.js.snap | 26 +- .../__snapshots__/summary.spec.js.snap | 42 +-- .../src/components/instances/summary.js | 3 +- .../__tests__/__snapshots__/cns.spec.js.snap | 198 +++++++++-- .../__snapshots__/firewall.spec.js.snap | 320 ++++++++++++++---- .../__tests__/__snapshots__/list.spec.js.snap | 314 ++++++++++++----- .../__snapshots__/metadata.spec.js.snap | 110 ++++-- .../__snapshots__/networks.spec.js.snap | 88 ++++- .../__snapshots__/summary.spec.js.snap | 166 +++++++-- .../__tests__/__snapshots__/tags.spec.js.snap | 176 ++++++++-- .../__snapshots__/breadcrumb.spec.js.snap | 44 ++- .../src/components/header.js | 2 +- .../instance-steps/src/image/components.js | 18 +- .../instance-steps/src/package/components.js | 175 +++++++++- packages/instance-steps/src/package/index.js | 46 ++- packages/instance-steps/src/tags/index.js | 2 +- .../__snapshots__/firewall.spec.js.snap | 3 - .../__snapshots__/network.spec.js.snap | 6 - .../__snapshots__/index.spec.js.snap | 22 +- .../ui-toolkit/src/breakpoints/screens.js | 18 +- .../__tests__/__snapshots__/form.spec.js.snap | 2 - packages/ui-toolkit/src/form/base/toggle.js | 1 - packages/ui-toolkit/src/index.js | 3 +- .../__snapshots__/layout.spec.js.snap | 66 +++- .../src/layout/__tests__/layout.spec.js | 2 +- .../ui-toolkit/src/layout/view-container.js | 16 +- .../ui-toolkit/src/styleguide/parallax.js | 6 +- 30 files changed, 1508 insertions(+), 442 deletions(-) diff --git a/consoles/my-joy-images/src/components/summary.js b/consoles/my-joy-images/src/components/summary.js index 448ad799..3f659d77 100644 --- a/consoles/my-joy-images/src/components/summary.js +++ b/consoles/my-joy-images/src/components/summary.js @@ -6,6 +6,7 @@ import Flex, { FlexItem } from 'styled-flex-component'; import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; import titleCase from 'title-case'; import remcalc from 'remcalc'; +import { ValueBreakpoints as breakpoints } from 'joyent-ui-toolkit'; import { Card, @@ -37,7 +38,7 @@ const VerticalDivider = styled.div` align-self: flex-end; margin: 0 ${remcalc(18)}; - @media (max-width: ${remcalc(767)}) { + @media (max-width: ${remcalc(breakpoints.small.upper)}) { display: none; } `; diff --git a/consoles/my-joy-instances/src/components/__tests__/__snapshots__/menu.spec.js.snap b/consoles/my-joy-instances/src/components/__tests__/__snapshots__/menu.spec.js.snap index f86182a6..16944213 100644 --- a/consoles/my-joy-instances/src/components/__tests__/__snapshots__/menu.spec.js.snap +++ b/consoles/my-joy-instances/src/components/__tests__/__snapshots__/menu.spec.js.snap @@ -36,7 +36,7 @@ exports[`renders without throwing 1`] = ` .c0 { box-sizing: border-box; width: 100%; - max-width: 62.5rem; + max-width: 78.75rem; } .c4 { @@ -113,10 +113,24 @@ exports[`renders without throwing 1`] = ` } } -@media only screen and (max-width:47.9375rem) { +@media only screen and (max-width:37.4375rem) { .c0 { - padding-left: 0.375rem; - padding-right: 0.375rem; + padding-left: 0.75rem; + padding-right: 0.75rem; + } +} + +@media only screen and (min-width:37.5rem) and (max-width:62.4375rem) { + .c0 { + padding-left: 1.875rem; + padding-right: 1.875rem; + } +} + +@media only screen and (min-width:62.5rem) and (max-width:87.4375rem) { + .c0 { + padding-left: 4.375rem; + padding-right: 4.375rem; } } diff --git a/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/list.spec.js.snap b/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/list.spec.js.snap index 917ca89f..90a13f9c 100644 --- a/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/list.spec.js.snap +++ b/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/list.spec.js.snap @@ -94,7 +94,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -483,14 +482,14 @@ exports[`renders without throwing 1`] = ` margin: 0 0.1875rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 8.125rem; display: table-cell; @@ -812,7 +811,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -1201,14 +1199,14 @@ exports[`renders without throwing 1`] = ` margin: 0 0.1875rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 8.125rem; display: table-cell; @@ -1530,7 +1528,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -1919,14 +1916,14 @@ exports[`renders without throwing 1`] = ` margin: 0 0.1875rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 8.125rem; display: table-cell; @@ -2248,7 +2245,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -2637,14 +2633,14 @@ exports[`renders without throwing 1`] = ` margin: 0 0.1875rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 8.125rem; display: table-cell; @@ -2966,7 +2962,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -3355,14 +3350,14 @@ exports[`renders without throwing 1`] = ` margin: 0 0.1875rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 8.125rem; display: table-cell; @@ -3684,7 +3679,6 @@ exports[`renders {children} without throwing 1`] = height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -4073,14 +4067,14 @@ exports[`renders {children} without throwing 1`] = margin: 0 0.1875rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 8.125rem; display: table-cell; @@ -4452,7 +4446,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -4679,14 +4672,14 @@ exports[`renders without throwing 1`] = ` height: 3rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c14 { width: 8.125rem; display: table-cell; @@ -4980,7 +4973,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -5207,14 +5199,14 @@ exports[`renders without throwing 1`] = ` height: 3rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c14 { width: 8.125rem; display: table-cell; @@ -5510,7 +5502,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -5737,14 +5728,14 @@ exports[`renders without throwing 1`] = ` height: 3rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c13 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c14 { width: 8.125rem; display: table-cell; @@ -6027,7 +6018,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -6252,14 +6242,14 @@ exports[`renders without throwing 1`] = ` display: block; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c16 { width: 10rem; display: table-cell; } } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c17 { width: 8.125rem; display: table-cell; diff --git a/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/snapshots.spec.js.snap b/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/snapshots.spec.js.snap index c3fd585d..ef7a5794 100644 --- a/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/snapshots.spec.js.snap +++ b/consoles/my-joy-instances/src/components/instances/__tests__/__snapshots__/snapshots.spec.js.snap @@ -75,7 +75,6 @@ Array [ height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -360,7 +359,7 @@ Array [ border-bottom-width: 0.0625rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c12 { width: 10rem; display: table-cell; @@ -976,7 +975,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -1150,7 +1148,7 @@ exports[`renders without throwing 1`] = ` border-bottom-width: 0.0625rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c9 { width: 10rem; display: table-cell; @@ -1371,7 +1369,6 @@ exports[`renders without throwing 1`] = ` height: 1.125rem; box-sizing: border-box; top: 0; - right: 0; cursor: pointer; background-color: rgb(255,255,255); box-shadow: none; @@ -1545,7 +1542,7 @@ exports[`renders without throwing 1`] = ` border-bottom-width: 0.0625rem; } -@media only screen and (min-width:47.9375rem) { +@media only screen and (min-width:37.4375rem) { .c9 { width: 10rem; display: table-cell; @@ -1625,7 +1622,7 @@ exports[`renders without throwing 1`] = ` name="td" selected={undefined} > - 5 months + 6 months without throwing 1`] = ` } } -@media (max-width:47.9375rem) { +@media (max-width:37.4375rem) { .c17 { display: none; } @@ -1509,7 +1509,7 @@ exports[`renders without throwing 1`] = ` >