Skip to content

Commit 44f04ec

Browse files
committed
feat(Admin > Edit Album): Yellow border to indicate multiple selected thumbs
1 parent e03fa23 commit 44f04ec

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/components/AdminAlbum/Thumbs.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default function AdminAlbumThumbs(
1414
},
1515
) {
1616
const items = xmlAlbum.album.item ? (Array.isArray(xmlAlbum.album.item) ? xmlAlbum.album.item : [xmlAlbum.album.item]) : []
17+
const hasMultiSelection = (selectedIndices?.size ?? 0) > 1
1718

1819
if (items.length === 0) {
1920
return <div>No items found</div>
@@ -34,6 +35,7 @@ export default function AdminAlbumThumbs(
3435
key={filename}
3536
id={`select${item.$.id}`}
3637
viewed={isSelected}
38+
multiSelected={hasMultiSelection && isSelected}
3739
/>
3840
)
3941
})}

src/components/ThumbImg/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import config from '../../../src/models/config'
44
import Img from '../Img'
55
import styles from './styles.module.css'
66

7-
function getViewed(viewed: boolean) {
7+
function getViewed(viewed: boolean, multiSelected: boolean) {
88
if (viewed) {
9-
return `${styles.highlight} ${styles.imgButton}`
9+
return `${multiSelected ? styles.highlightMulti : styles.highlight} ${styles.imgButton}`
1010
}
1111
return styles.imgButton
1212
}
@@ -18,13 +18,15 @@ function ThumbImg({
1818
src,
1919
id,
2020
viewed: globalViewed = false,
21+
multiSelected = false,
2122
}: {
2223
onClick?: (event: MouseEvent<HTMLAnchorElement | HTMLUListElement>) => void;
2324
caption: string;
2425
href?: string;
2526
src: string;
2627
id: string;
2728
viewed: boolean;
29+
multiSelected?: boolean;
2830
}) {
2931
// Keep visuals (local state for immediate feedback) but never reset globally
3032
const [viewed, setViewed] = useState(globalViewed)
@@ -43,7 +45,7 @@ function ThumbImg({
4345

4446
return (
4547
<li className={styles.bullet}>
46-
<a className={getViewed(globalViewed || viewed)} href={href} onClick={handleClick} id={id}>
48+
<a className={getViewed(globalViewed || viewed, multiSelected)} href={href} onClick={handleClick} id={id}>
4749
<Img
4850
src={src}
4951
alt={caption}

src/components/ThumbImg/styles.module.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@
2525
.highlight {
2626
border-color: white;
2727
}
28+
.highlightMulti {
29+
border-color: #d9c24a;
30+
}

0 commit comments

Comments
 (0)