From 36fe175f8fcb9559910c8862614957e179337044 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 2 Jan 2023 04:20:20 -0800 Subject: [PATCH 1/8] Make responsive updates to weapon grid CSS --- components/PartyDetails/index.scss | 3 +- components/PartySegmentedControl/index.scss | 35 +++++++--- components/WeaponGrid/index.scss | 74 ++++++++++----------- components/WeaponGrid/index.tsx | 2 +- components/WeaponUnit/index.scss | 40 ++++------- components/WeaponUnit/index.tsx | 4 +- styles/variables.scss | 2 + 7 files changed, 79 insertions(+), 81 deletions(-) diff --git a/components/PartyDetails/index.scss b/components/PartyDetails/index.scss index 6d1e0e43..2c570b1d 100644 --- a/components/PartyDetails/index.scss +++ b/components/PartyDetails/index.scss @@ -1,7 +1,8 @@ .DetailsWrapper { display: flex; flex-direction: column; - margin-top: $unit-4x; + margin: $unit-4x auto 0 auto; + max-width: $grid-width; @include breakpoint(phone) { padding: 0 $unit; diff --git a/components/PartySegmentedControl/index.scss b/components/PartySegmentedControl/index.scss index 5fd02fa6..a6fd6c50 100644 --- a/components/PartySegmentedControl/index.scss +++ b/components/PartySegmentedControl/index.scss @@ -6,22 +6,30 @@ justify-content: center; margin: 0 auto; margin-bottom: $unit * 3; - max-width: 760px; + max-width: $grid-width; position: relative; - @include breakpoint(phone) { - gap: $unit; - margin-left: 0; - margin-right: 0; - padding: 0 $unit; - max-width: auto; - width: 100%; + // prettier-ignore + @media only screen + and (max-width: 550px) + and (max-height: 920px) + and (-webkit-min-device-pixel-ratio: 2) { + gap: $unit; + margin-left: 0; + margin-right: 0; + padding: 0 $unit; + max-width: auto; + width: 100%; } .SegmentedControl { flex-grow: 1; - @include breakpoint(phone) { + // prettier-ignore + @media only screen + and (max-width: 550px) + and (max-height: 920px) + and (-webkit-min-device-pixel-ratio: 2) { flex-grow: 1; width: 100%; display: grid; @@ -34,13 +42,18 @@ color: #888; display: flex; font-weight: $normal; - gap: 8px; + gap: $unit; line-height: 34px; height: 100%; position: absolute; right: 0px; + top: 1px; - @include breakpoint(phone) { + // prettier-ignore + @media only screen + and (max-width: 550px) + and (max-height: 920px) + and (-webkit-min-device-pixel-ratio: 2) { position: static; .Text { diff --git a/components/WeaponGrid/index.scss b/components/WeaponGrid/index.scss index e50bd027..17672ca1 100644 --- a/components/WeaponGrid/index.scss +++ b/components/WeaponGrid/index.scss @@ -1,52 +1,50 @@ -#MainGrid { +#WeaponGrid { display: flex; justify-content: center; - @include breakpoint(phone) { + #MainGrid { + aspect-ratio: 2/1; display: grid; - grid-template-columns: 1fr auto; - } - - .grid_weapons { - display: grid; - grid-template-columns: 1fr 1fr 1fr; - grid-template-rows: 1fr 1fr 1fr; - margin: 0; - padding: 0; - max-width: 528px; - } -} - -#MainGrid, -#ExtraGrid { - .grid_weapons > * { - margin-bottom: $unit-3x; - margin-right: $unit-3x; + gap: $unit-3x; + grid-template-columns: 1.278fr 3fr; + justify-items: center; + grid-template-areas: + 'mainhand grid' + 'mainhand grid' + 'mainhand grid'; + max-width: $grid-width; @include breakpoint(tablet) { - margin-bottom: $unit-2x; - margin-right: $unit-2x; + gap: $unit-2x; } + @include breakpoint(phone) { + gap: $unit; + } + } + + .Weapons { + display: grid; /* make the right-images container a grid */ + grid-template-columns: repeat( + 3, + minmax(0, 1fr) + ); /* create 3 columns, each taking up 1 fraction */ + grid-template-rows: repeat( + 3, + 1fr + ); /* create 3 rows, each taking up 1 fraction */ + gap: $unit-3x; + @include breakpoint(tablet) { - margin-bottom: $unit; - margin-right: $unit; + gap: $unit-2x; } - &:nth-last-child(-n + 3) { - margin-bottom: 0; + @include breakpoint(phone) { + gap: $unit; + } + + li { + list-style: none; } } - - .grid_weapons > *:nth-child(3n + 3) { - margin-right: 0; - } - - .grid_weapons > li { - list-style: none; - } -} - -#ExtraWeapons #grid_weapons > * { - margin-bottom: 0; } diff --git a/components/WeaponGrid/index.tsx b/components/WeaponGrid/index.tsx index 83d8aad0..e6e7c417 100644 --- a/components/WeaponGrid/index.tsx +++ b/components/WeaponGrid/index.tsx @@ -361,7 +361,7 @@ const WeaponGrid = (props: Props) => { {incompatibleAlert()}
{mainhandElement} - +
{(() => { diff --git a/components/WeaponUnit/index.scss b/components/WeaponUnit/index.scss index fbe832d8..830c1559 100644 --- a/components/WeaponUnit/index.scss +++ b/components/WeaponUnit/index.scss @@ -1,9 +1,11 @@ .WeaponUnit { + align-items: center; display: flex; flex-direction: column; - gap: 4px; - min-height: 139px; + gap: $unit-half; position: relative; + width: 100%; + height: auto; @include breakpoint(tablet) { min-height: auto; @@ -25,25 +27,14 @@ } &.mainhand { - margin-right: $unit-3x; - max-width: 200px; - - @include breakpoint(tablet) { - margin-right: $unit-2x; - } - - @include breakpoint(phone) { - margin-right: $unit-2x; - margin-right: $unit; - } + display: flex; &.editable .WeaponImage:hover { transform: $scale-tall; } .WeaponImage { - aspect-ratio: 200 / 418; - width: 200px; + width: 100%; height: auto; .Awakening { @@ -62,20 +53,13 @@ height: auto; } } - - @include breakpoint(tablet) { - width: 25vw; - } } } &.grid { - max-width: 160px; - .WeaponImage { - aspect-ratio: 160 / 92; list-style-type: none; - width: 160px; + width: 100%; height: auto; .Awakening { @@ -94,10 +78,6 @@ height: auto; } } - - @include breakpoint(tablet) { - width: 20vw; - } } } @@ -189,4 +169,10 @@ } } } + + .WeaponName { + @include breakpoint(phone) { + font-size: $font-tiny; + } + } } diff --git a/components/WeaponUnit/index.tsx b/components/WeaponUnit/index.tsx index dc30dd4a..fba0d827 100644 --- a/components/WeaponUnit/index.tsx +++ b/components/WeaponUnit/index.tsx @@ -395,9 +395,7 @@ const WeaponUnit = (props: Props) => { gridWeapon.id && canBeModified(gridWeapon) ? ( -
-
+