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

switch hoverable elements to use :hover #854

Merged
merged 2 commits into from
Jan 17, 2025
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
10 changes: 10 additions & 0 deletions cardboard/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ body {
line-height: normal;
}

.clickable-puzzle-cell {
cursor: pointer;
min-height: 1.4rem;
width: 100%;
}

.clickable-puzzle-cell:hover {
background-color: #ffe579;
}

:root {
--bs-navbar-padding-y: .5rem;
--bs-nav-link-padding-x: 1rem;
Expand Down
10 changes: 2 additions & 8 deletions hunts/src/NameCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default function NameCell({

return (
<div
className="clickable-puzzle-cell"
onMouseEnter={() => {
setUiHovered(true);
}}
Expand All @@ -128,14 +129,7 @@ export default function NameCell({
},
})
);
}}
style={{
// TODO: abstract these properties out into their own CSS class
paddingLeft: `${row.depth * 2}rem`,
minHeight: '1.4rem', cursor: 'pointer',
backgroundColor: uiHovered ? '#ffe579' : undefined
}}
>
}}>
<div
onMouseEnter={() => {
setUiHovered(true);
Expand Down
3 changes: 1 addition & 2 deletions hunts/src/NotesCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function NotesCell({ row, value }: { row: Row; value: string }) {

return (
<div
className="clickable-puzzle-cell"
onMouseEnter={() => {
setUiHovered(true);
}}
Expand All @@ -26,8 +27,6 @@ export default function NotesCell({ row, value }: { row: Row; value: string }) {
setEditedNotesValue(value);
}
}}
// TODO: abstract these properties out into their own CSS class
style={{width: "100%", minHeight: '1.4rem', cursor: !editing ? 'pointer' : undefined, backgroundColor: uiHovered && !editing ? '#ffe579' : undefined}}
>
{editing ?
<div style={{ display: 'flex' }}>
Expand Down
14 changes: 5 additions & 9 deletions hunts/src/TagCell.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { showModal } from "./modalSlice";
import { faTag } from "@fortawesome/free-solid-svg-icons";
import { toggleFilterTag } from "./filterSlice";
import TagPill from "./TagPill";
import ClickableIcon from "./ClickableIcon";

import type { RootState } from "./store";
import type { Hunt, Puzzle, Row } from "./types";
Expand All @@ -23,6 +21,7 @@ function TagCell({ row }: { row: Row<Puzzle> }) {

return (
<div
className="clickable-puzzle-cell"
onMouseEnter={() => {
setUiHovered(true);
}}
Expand All @@ -40,19 +39,16 @@ function TagCell({ row }: { row: Row<Puzzle> }) {
},
})
);
}}
style={{
// TODO: abstract these properties out into their own CSS class
cursor: 'pointer',
minHeight: '1.4rem',
backgroundColor: uiHovered ? '#ffe579' : undefined
}}>
{tagsToShow.map(({ name, color, id }) => (
<TagPill
name={name}
color={color}
key={name}
onClick={() => dispatch(toggleFilterTag({ name, color, id }))}
onClick={(e: React.MouseEvent) => {
e.stopPropagation();
dispatch(toggleFilterTag({ name, color, id }));
}}
/>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion hunts/src/TagPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface TagPillProps {
color: string;
selected?: boolean;
faded?: boolean;
onClick?: (() => void) | null;
onClick?: React.MouseEventHandler<HTMLElement>;
}

function TagPill(props: TagPillProps) {
Expand Down
Loading