Fix party header styles

This commit is contained in:
Justin Edmund 2023-06-23 19:15:12 -07:00
parent 6ea11324c9
commit 4c50360476
2 changed files with 57 additions and 96 deletions

View file

@ -1,4 +1,4 @@
.DetailsWrapper { .wrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: $unit-2x; gap: $unit-2x;
@ -16,7 +16,7 @@
} }
} }
.PartyDetails { .details {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
line-height: 1.4; line-height: 1.4;
@ -40,14 +40,6 @@
white-space: pre-line; white-space: pre-line;
} }
.Tokens {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: $unit;
margin-bottom: $unit-2x;
}
.YoutubeWrapper { .YoutubeWrapper {
background-color: var(--card-bg); background-color: var(--card-bg);
border-radius: $card-corner; border-radius: $card-corner;
@ -133,7 +125,7 @@
} }
} }
.PartyInfo { .info {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -148,15 +140,10 @@
padding: 0 $unit; padding: 0 $unit;
} }
& > .Right { & > .left {
display: flex;
gap: $unit-half;
}
& > .Left {
flex-grow: 1; flex-grow: 1;
.Header { .header {
align-items: center; align-items: center;
display: flex; display: flex;
gap: $unit; gap: $unit;
@ -186,6 +173,11 @@
height: 26px; height: 26px;
} }
& > *:not(:last-child):after {
content: ' · ';
margin: 0 calc($unit / 2);
}
time { time {
font-size: $font-small; font-size: $font-small;
} }
@ -202,39 +194,34 @@
color: $blue; color: $blue;
} }
& > *:not(:last-child):after { .user {
content: ' · '; align-items: center;
margin: 0 calc($unit / 2); display: inline-flex;
gap: calc($unit / 2);
margin-top: 1px;
img {
$diameter: 24px;
border-radius: calc($diameter / 2);
height: $diameter;
width: $diameter;
}
} }
} }
} }
.user { & > .right {
align-items: center; display: flex;
display: inline-flex; gap: $unit-half;
gap: calc($unit / 2);
margin-top: 1px;
img,
.no-user {
$diameter: 24px;
border-radius: calc($diameter / 2);
height: $diameter;
width: $diameter;
}
img.gran {
background-color: #cee7fe;
}
img.djeeta {
background-color: #ffe1fe;
}
.no-user {
background: $grey-80;
}
} }
} }
.tokens {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: $unit;
margin-bottom: $unit-2x;
}
} }

View file

@ -62,13 +62,9 @@ const PartyHeader = (props: Props) => {
const [turnCount, setTurnCount] = useState<number | undefined>(undefined) const [turnCount, setTurnCount] = useState<number | undefined>(undefined)
const [clearTime, setClearTime] = useState(0) const [clearTime, setClearTime] = useState(0)
const classes = classNames({
PartyDetails: true,
})
const userClass = classNames({ const userClass = classNames({
user: true, [styles.user]: true,
empty: !party.user, [styles.empty]: !party.user,
}) })
const linkClass = classNames({ const linkClass = classNames({
@ -243,13 +239,7 @@ const PartyHeader = (props: Props) => {
// Render: Tokens // Render: Tokens
const chargeAttackToken = ( const chargeAttackToken = (
<Token <Token active={party.chargeAttack} className="chargeAttack">
className={classNames({
ChargeAttack: true,
On: party.chargeAttack,
Off: !party.chargeAttack,
})}
>
{`${t('party.details.labels.charge_attack')} ${ {`${t('party.details.labels.charge_attack')} ${
party.chargeAttack ? 'On' : 'Off' party.chargeAttack ? 'On' : 'Off'
}`} }`}
@ -257,13 +247,7 @@ const PartyHeader = (props: Props) => {
) )
const fullAutoToken = ( const fullAutoToken = (
<Token <Token active={party.fullAuto} className="fullAuto">
className={classNames({
FullAuto: true,
On: party.fullAuto,
Off: !party.fullAuto,
})}
>
{`${t('party.details.labels.full_auto')} ${ {`${t('party.details.labels.full_auto')} ${
party.fullAuto ? 'On' : 'Off' party.fullAuto ? 'On' : 'Off'
}`} }`}
@ -271,13 +255,7 @@ const PartyHeader = (props: Props) => {
) )
const autoGuardToken = ( const autoGuardToken = (
<Token <Token active className="autoGuard">
className={classNames({
AutoGuard: true,
On: party.autoGuard,
Off: !party.autoGuard,
})}
>
{`${t('party.details.labels.auto_guard')} ${ {`${t('party.details.labels.auto_guard')} ${
party.autoGuard ? 'On' : 'Off' party.autoGuard ? 'On' : 'Off'
}`} }`}
@ -285,13 +263,7 @@ const PartyHeader = (props: Props) => {
) )
const autoSummonToken = ( const autoSummonToken = (
<Token <Token active={party.autoSummon} className="autoSummon">
className={classNames({
AutoSummon: true,
On: party.autoSummon,
Off: !party.autoSummon,
})}
>
{`${t('party.details.labels.auto_summon')} ${ {`${t('party.details.labels.auto_summon')} ${
party.autoSummon ? 'On' : 'Off' party.autoSummon ? 'On' : 'Off'
}`} }`}
@ -348,15 +320,16 @@ const PartyHeader = (props: Props) => {
function renderTokens() { function renderTokens() {
return ( return (
<section className="Tokens"> <>
{' '}
{chargeAttackToken} {chargeAttackToken}
{fullAutoToken} {fullAutoToken}
{autoGuardToken}
{autoSummonToken} {autoSummonToken}
{autoGuardToken}
{party.turnCount ? turnCountToken : ''} {party.turnCount ? turnCountToken : ''}
{party.clearTime > 0 ? clearTimeToken() : ''} {party.clearTime > 0 ? clearTimeToken() : ''}
{buttonChainToken()} {buttonChainToken()}
</section> </>
) )
} }
@ -394,17 +367,18 @@ const PartyHeader = (props: Props) => {
return ( return (
<> <>
<section className="DetailsWrapper"> <header className={styles.wrapper}>
<div className="PartyInfo"> <section className={styles.info}>
<div className="Left"> <div className={styles.left}>
<div className="Header"> <div className={styles.header}>
<h1 className={party.name ? '' : 'empty'}> <h1 className={party.name ? '' : 'empty'}>
{party.name ? party.name : t('no_title')} {party.name ? party.name : t('no_title')}
</h1> </h1>
{party.remix && party.sourceParty ? ( {party.remix && party.sourceParty ? (
<Tooltip content={t('tooltips.source')}> <Tooltip content={t('tooltips.source')}>
<Button <Button
className="IconButton Blended" className="IconButton"
blended={true}
leftAccessoryIcon={<RemixIcon />} leftAccessoryIcon={<RemixIcon />}
text={t('tokens.remix')} text={t('tokens.remix')}
onClick={() => goTo(party.sourceParty?.shortcode)} onClick={() => goTo(party.sourceParty?.shortcode)}
@ -414,12 +388,12 @@ const PartyHeader = (props: Props) => {
'' ''
)} )}
</div> </div>
<div className="attribution"> <div className={styles.attribution}>
{renderUserBlock()} {renderUserBlock()}
{appState.party.raid ? linkedRaidBlock(appState.party.raid) : ''} {appState.party.raid ? linkedRaidBlock(appState.party.raid) : ''}
{party.created_at != '' ? ( {party.created_at != '' ? (
<time <time
className="last-updated" className={styles.lastUpdated}
dateTime={new Date(party.created_at).toString()} dateTime={new Date(party.created_at).toString()}
> >
{formatTimeAgo(new Date(party.created_at), locale)} {formatTimeAgo(new Date(party.created_at), locale)}
@ -430,7 +404,7 @@ const PartyHeader = (props: Props) => {
</div> </div>
</div> </div>
{party.editable ? ( {party.editable ? (
<div className="Right"> <div className={styles.right}>
<EditPartyModal <EditPartyModal
party={props.party} party={props.party}
updateCallback={props.updateCallback} updateCallback={props.updateCallback}
@ -447,14 +421,14 @@ const PartyHeader = (props: Props) => {
/> />
</div> </div>
) : ( ) : (
<div className="Right"> <div className={styles.right}>
{saveButton()} {saveButton()}
{remixButton()} {remixButton()}
</div> </div>
)} )}
</div> </section>
<section className={classes}>{renderTokens()}</section> <section className={styles.tokens}>{renderTokens()}</section>
</section> </header>
<RemixTeamAlert <RemixTeamAlert
creator={props.editable} creator={props.editable}