forked from oyeolamilekan/appshots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionButton.tsx
More file actions
49 lines (46 loc) · 1.11 KB
/
Copy pathSelectionButton.tsx
File metadata and controls
49 lines (46 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* SelectionButton Component
*
* Reusable button for selection lists (devices, export sizes).
*/
import { STYLES } from "./constants";
interface SelectionButtonProps {
/** Button label text */
label: string;
/** Whether this option is selected */
isSelected: boolean;
/** Click handler */
onClick: () => void;
}
/**
* SelectionButton - Toggleable selection button
*
* A full-width button used in selection lists.
* Shows active/inactive state with different styling.
*
* @param props - Component props
* @param props.label - Button text
* @param props.isSelected - Whether button is in selected state
* @param props.onClick - Click handler
*
* @example
* <SelectionButton
* label="iPhone 15 Pro"
* isSelected={selectedId === "iphone-15-pro"}
* onClick={() => setSelectedId("iphone-15-pro")}
* />
*/
export const SelectionButton = ({
label,
isSelected,
onClick,
}: SelectionButtonProps) => (
<button
className={`${STYLES.selectionButton} ${
isSelected ? STYLES.selectionButtonActive : STYLES.selectionButtonInactive
}`}
onClick={onClick}
>
{label}
</button>
);