From b8d4529f21eb34c3d5d56a90bd886d9ecd5ffe0f Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 16 Apr 2023 03:50:12 -0700 Subject: [PATCH] Modify PartySegmentedControl to use RepSegments This will not work on mobile yet, where it should gracefully degrade to a normal SegmentedControl with only text --- components/common/SegmentedControl/index.scss | 5 +- .../party/PartySegmentedControl/index.scss | 2 + .../party/PartySegmentedControl/index.tsx | 89 +++++++++++++------ 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/components/common/SegmentedControl/index.scss b/components/common/SegmentedControl/index.scss index a0638f8a..31d49e83 100644 --- a/components/common/SegmentedControl/index.scss +++ b/components/common/SegmentedControl/index.scss @@ -4,7 +4,6 @@ } .SegmentedControl { - background: var(--card-bg); border-radius: $unit * 3; display: inline-flex; padding: 3px; @@ -13,6 +12,10 @@ overflow: hidden; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + @include breakpoint(phone) { + background: var(--card-bg); + } + &.fire { .Segment input:checked + label { background: var(--fire-bg); diff --git a/components/party/PartySegmentedControl/index.scss b/components/party/PartySegmentedControl/index.scss index a6fd6c50..cc9379af 100644 --- a/components/party/PartySegmentedControl/index.scss +++ b/components/party/PartySegmentedControl/index.scss @@ -23,6 +23,7 @@ } .SegmentedControl { + gap: $unit; flex-grow: 1; // prettier-ignore @@ -31,6 +32,7 @@ and (max-height: 920px) and (-webkit-min-device-pixel-ratio: 2) { flex-grow: 1; + gap: 0; width: 100%; display: grid; grid-template-columns: auto auto auto; diff --git a/components/party/PartySegmentedControl/index.tsx b/components/party/PartySegmentedControl/index.tsx index 1c807dfb..2eac98b0 100644 --- a/components/party/PartySegmentedControl/index.tsx +++ b/components/party/PartySegmentedControl/index.tsx @@ -12,6 +12,11 @@ import { GridType } from '~utils/enums' import './index.scss' import classNames from 'classnames' +import RepSegment from '~components/reps/RepSegment' +import CharacterRep from '~components/reps/CharacterRep' +import { accountState } from '~utils/accountState' +import WeaponRep from '~components/reps/WeaponRep' +import SummonRep from '~components/reps/SummonRep' interface Props { selectedTab: GridType @@ -47,6 +52,57 @@ const PartySegmentedControl = (props: Props) => { } } + const characterSegment = () => { + return ( + + + + ) + } + + const weaponSegment = () => { + { + return ( + + + + ) + } + } + + const summonSegment = () => { + return ( + + + + ) + } + const extraToggle = (
Extra @@ -67,39 +123,16 @@ const PartySegmentedControl = (props: Props) => { })} > - - {t('party.segmented_control.characters')} - - - - {t('party.segmented_control.weapons')} - - - - {t('party.segmented_control.summons')} - + {characterSegment()} + {weaponSegment()} + {summonSegment()} - {(() => { + {/* {(() => { if (party.editable && props.selectedTab == GridType.Weapon) { return extraToggle } - })()} + })()} */}
) }