Skip to content

Commit

Permalink
Replace senator links for non-selectable list item (#289)
Browse files Browse the repository at this point in the history
Replace senator link with just the senators name in bold when the senator item is part of a non-selectable list, like in an action dialog. Also fix some CSS `user-select` things.
  • Loading branch information
iamlogand authored Oct 3, 2023
1 parent 655520e commit 26b5fb4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/components/FactionLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const FactionLink = (props: FactionLinkProps) => {
}

return (
<Link component="button" onClick={handleClick} sx={{ verticalAlign: "baseline" }}>
<Link component="button" onClick={handleClick} sx={{ verticalAlign: "baseline", userSelect: 'auto' }}>
{props.includeIcon && <span style={{ marginRight: 4 }}><FactionIcon faction={props.faction} size={17} /></span>}
{props.faction.getName()} Faction
</Link>
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/SenatorLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SenatorLink = (props: SenatorLinkProps) => {
}

return (
<Link component="button" onClick={handleClick} sx={{ verticalAlign: "baseline" }}>{props.senator.displayName}</Link>
<Link component="button" onClick={handleClick} sx={{ verticalAlign: "baseline", userSelect: 'auto' }}>{props.senator.displayName}</Link>
)
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/SenatorListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const SenatorListItem = ({ senator, ...props }: SenatorListItemProps) => {
<div key={senator.id} className={`${styles.senatorListItem} ${props.radioSelected ? styles.radioSelected : ''}`}>
<SenatorPortrait senator={senator} size={80} selectable={props.selectableSenators} />
<div className={styles.primaryArea}>
<p><b><SenatorLink senator={senator} /></b></p>
<p><b>{props.selectableSenators ? <SenatorLink senator={senator} /> : <span>{senator.displayName}</span>}</b></p>
<p>
{faction ?
(props.selectableFactions &&
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/SenatorPortrait.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.senatorPortrait {
user-select: none;
}

.senatorPortrait.selectable {
cursor: pointer;

Expand All @@ -23,10 +27,6 @@
margin-inline-end: 0;
}

.senatorPortrait>figure {
background-color: var(--foreground-color);
}

.bg {
position: absolute;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/SenatorPortrait.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const SenatorPortrait = ({ senator, size, ...props }: SenatorPortraitProps) => {
}

// Get JSX for the portrait
const PortraitElement = props.selectable ? 'button' : 'div'
const getPortrait = () => {
return (
<PortraitElement
Expand Down Expand Up @@ -234,7 +235,6 @@ const SenatorPortrait = ({ senator, size, ...props }: SenatorPortraitProps) => {
)
}

const PortraitElement = props.selectable ? 'button' : 'div'
if (props.nameTooltip) {
return <Tooltip key={key} title={`${senator.displayName}`} enterDelay={500} arrow>{getPortrait()}</Tooltip>
} else {
Expand Down

0 comments on commit 26b5fb4

Please sign in to comment.