@@ -16,10 +16,14 @@ export interface ISeatProps extends ISeat {
1616 categories : ISeatCategory [ ] ;
1717 sections : ISection [ ] ;
1818 onClick : ( e : any ) => void ;
19+ isSelected ?: boolean ;
1920}
2021
2122const Seat : React . FC < ISeatProps > = forwardRef (
22- ( { x, y, id, label, categories, category, sections, status, onClick, consumer, element, ...props } , ref : any ) => {
23+ (
24+ { x, y, id, label, categories, category, sections, status, onClick, consumer, element, isSelected, ...props } ,
25+ ref : any
26+ ) => {
2327 const categoryObject = useMemo ( ( ) => categories ?. find ?.( ( c ) => c . id === category ) , [ categories , category ] ) ;
2428 const sectionObject = useMemo (
2529 ( ) => sections ?. find ?.( ( s ) => s . id === categoryObject ?. section ) ,
@@ -28,6 +32,8 @@ const Seat: React.FC<ISeatProps> = forwardRef(
2832
2933 const showLabel = consumer . options ?. showSeatLabels ?? true ;
3034
35+ const SeatIcon = isSelected ? consumer . options ?. selectedSeatIcon : consumer . options ?. seatIcon ;
36+
3137 const textX = useMemo ( ( ) => {
3238 let value = ( + ref . current ?. getAttribute ( "cx" ) || x ) - seatLabelFontSize / 3.5 ;
3339 const labelLength = label ?. toString ( ) ?. length ?? 0 ;
@@ -79,7 +85,16 @@ const Seat: React.FC<ISeatProps> = forwardRef(
7985 { ...props }
8086 className = { twMerge ( props . className , "filter hover:brightness-[1.05]" ) }
8187 />
82- { label && showLabel && (
88+ { SeatIcon && (
89+ < SeatIcon
90+ x = { x - seatSize / 2.73 }
91+ y = { y - seatSize / 2.65 }
92+ width = { seatSize * 0.75 }
93+ height = { seatSize * 0.75 }
94+ size = { seatSize * 0.75 }
95+ />
96+ ) }
97+ { label && showLabel && ! SeatIcon && (
8398 < text
8499 id = { `${ id } -label` }
85100 x = { textX }
0 commit comments