Make responsive updates to weapon grid CSS

This commit is contained in:
Justin Edmund 2023-01-02 04:20:20 -08:00
parent 67fba83239
commit 36fe175f8f
7 changed files with 79 additions and 81 deletions

View file

@ -1,7 +1,8 @@
.DetailsWrapper { .DetailsWrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: $unit-4x; margin: $unit-4x auto 0 auto;
max-width: $grid-width;
@include breakpoint(phone) { @include breakpoint(phone) {
padding: 0 $unit; padding: 0 $unit;

View file

@ -6,10 +6,14 @@
justify-content: center; justify-content: center;
margin: 0 auto; margin: 0 auto;
margin-bottom: $unit * 3; margin-bottom: $unit * 3;
max-width: 760px; max-width: $grid-width;
position: relative; position: relative;
@include breakpoint(phone) { // prettier-ignore
@media only screen
and (max-width: 550px)
and (max-height: 920px)
and (-webkit-min-device-pixel-ratio: 2) {
gap: $unit; gap: $unit;
margin-left: 0; margin-left: 0;
margin-right: 0; margin-right: 0;
@ -21,7 +25,11 @@
.SegmentedControl { .SegmentedControl {
flex-grow: 1; 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; flex-grow: 1;
width: 100%; width: 100%;
display: grid; display: grid;
@ -34,13 +42,18 @@
color: #888; color: #888;
display: flex; display: flex;
font-weight: $normal; font-weight: $normal;
gap: 8px; gap: $unit;
line-height: 34px; line-height: 34px;
height: 100%; height: 100%;
position: absolute; position: absolute;
right: 0px; 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; position: static;
.Text { .Text {

View file

@ -1,52 +1,50 @@
#MainGrid { #WeaponGrid {
display: flex; display: flex;
justify-content: center; justify-content: center;
#MainGrid {
aspect-ratio: 2/1;
display: grid;
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) {
gap: $unit-2x;
}
@include breakpoint(phone) { @include breakpoint(phone) {
display: grid; gap: $unit;
grid-template-columns: 1fr auto; }
} }
.grid_weapons { .Weapons {
display: grid; display: grid; /* make the right-images container a grid */
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: repeat(
grid-template-rows: 1fr 1fr 1fr; 3,
margin: 0; minmax(0, 1fr)
padding: 0; ); /* create 3 columns, each taking up 1 fraction */
max-width: 528px; grid-template-rows: repeat(
} 3,
} 1fr
); /* create 3 rows, each taking up 1 fraction */
#MainGrid, gap: $unit-3x;
#ExtraGrid {
.grid_weapons > * {
margin-bottom: $unit-3x;
margin-right: $unit-3x;
@include breakpoint(tablet) { @include breakpoint(tablet) {
margin-bottom: $unit-2x; gap: $unit-2x;
margin-right: $unit-2x;
} }
@include breakpoint(tablet) { @include breakpoint(phone) {
margin-bottom: $unit; gap: $unit;
margin-right: $unit;
} }
&:nth-last-child(-n + 3) { li {
margin-bottom: 0;
}
}
.grid_weapons > *:nth-child(3n + 3) {
margin-right: 0;
}
.grid_weapons > li {
list-style: none; list-style: none;
} }
} }
#ExtraWeapons #grid_weapons > * {
margin-bottom: 0;
} }

View file

@ -361,7 +361,7 @@ const WeaponGrid = (props: Props) => {
{incompatibleAlert()} {incompatibleAlert()}
<div id="MainGrid"> <div id="MainGrid">
{mainhandElement} {mainhandElement}
<ul className="grid_weapons">{weaponGridElement}</ul> <ul className="Weapons">{weaponGridElement}</ul>
</div> </div>
{(() => { {(() => {

View file

@ -1,9 +1,11 @@
.WeaponUnit { .WeaponUnit {
align-items: center;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: $unit-half;
min-height: 139px;
position: relative; position: relative;
width: 100%;
height: auto;
@include breakpoint(tablet) { @include breakpoint(tablet) {
min-height: auto; min-height: auto;
@ -25,25 +27,14 @@
} }
&.mainhand { &.mainhand {
margin-right: $unit-3x; display: flex;
max-width: 200px;
@include breakpoint(tablet) {
margin-right: $unit-2x;
}
@include breakpoint(phone) {
margin-right: $unit-2x;
margin-right: $unit;
}
&.editable .WeaponImage:hover { &.editable .WeaponImage:hover {
transform: $scale-tall; transform: $scale-tall;
} }
.WeaponImage { .WeaponImage {
aspect-ratio: 200 / 418; width: 100%;
width: 200px;
height: auto; height: auto;
.Awakening { .Awakening {
@ -62,20 +53,13 @@
height: auto; height: auto;
} }
} }
@include breakpoint(tablet) {
width: 25vw;
}
} }
} }
&.grid { &.grid {
max-width: 160px;
.WeaponImage { .WeaponImage {
aspect-ratio: 160 / 92;
list-style-type: none; list-style-type: none;
width: 160px; width: 100%;
height: auto; height: auto;
.Awakening { .Awakening {
@ -94,10 +78,6 @@
height: auto; height: auto;
} }
} }
@include breakpoint(tablet) {
width: 20vw;
}
} }
} }
@ -189,4 +169,10 @@
} }
} }
} }
.WeaponName {
@include breakpoint(phone) {
font-size: $font-tiny;
}
}
} }

View file

@ -395,9 +395,7 @@ const WeaponUnit = (props: Props) => {
gridWeapon.id && gridWeapon.id &&
canBeModified(gridWeapon) ? ( canBeModified(gridWeapon) ? (
<WeaponModal gridWeapon={gridWeapon}> <WeaponModal gridWeapon={gridWeapon}>
<div>
<Button accessoryIcon={<SettingsIcon />} /> <Button accessoryIcon={<SettingsIcon />} />
</div>
</WeaponModal> </WeaponModal>
) : ( ) : (
'' ''

View file

@ -13,6 +13,8 @@ $laptop: 1280px;
$tablet: 768px; $tablet: 768px;
$phone: 375px; $phone: 375px;
$grid-width: 720px;
// Legacy // Legacy
$medium-screen: 768px; $medium-screen: 768px;