Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace senator links for non-selectable list item #289

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading