11import * as React from 'react' ;
22import { StoryObj } from '@storybook/react-vite' ;
33import { AgentSessionProvider } from '../../.storybook/lk-decorators/AgentSessionProvider' ;
4- import { AgentAudioVisualizerGrid , AgentAudioVisualizerGridProps } from '@agents-ui' ;
4+ import {
5+ AgentAudioVisualizerGrid ,
6+ AgentAudioVisualizerGridProps ,
7+ AgentAudioVisualizerGridCellVariants ,
8+ } from '@agents-ui' ;
59import { useSessionContext } from '@livekit/components-react' ;
10+ import { cn } from '@/lib/utils' ;
611
712export default {
813 component : AgentAudioVisualizerGrid ,
914 decorators : [ AgentSessionProvider ] ,
10- render : ( args : AgentAudioVisualizerGridProps ) => {
15+ render : ( { color , ... args } : AgentAudioVisualizerGridProps & { color ?: string } ) => {
1116 const {
1217 local : { microphoneTrack } ,
1318 } = useSessionContext ( ) ;
1419
15- return < AgentAudioVisualizerGrid { ...args } audioTrack = { microphoneTrack } /> ;
20+ return (
21+ < div style = { { color } } >
22+ < AgentAudioVisualizerGrid { ...args } audioTrack = { microphoneTrack } />
23+ </ div >
24+ ) ;
1625 } ,
1726 args : {
1827 size : 'lg' ,
@@ -21,6 +30,7 @@ export default {
2130 interval : 100 ,
2231 rowCount : 9 ,
2332 columnCount : 9 ,
33+ color : undefined ,
2434 } ,
2535 argTypes : {
2636 size : {
@@ -54,6 +64,7 @@ export default {
5464 control : { type : 'range' , min : 1 , max : 40 , step : 1 } ,
5565 } ,
5666 className : { control : { type : 'text' } } ,
67+ color : { control : { type : 'color' } } ,
5768 } ,
5869 parameters : {
5970 layout : 'centered' ,
@@ -64,47 +75,69 @@ export default {
6475} ;
6576
6677export const Default : StoryObj < AgentAudioVisualizerGridProps > = {
67- args : {
68-
69- } ,
78+ args : { } ,
7079} ;
7180
7281export const Demo1 : StoryObj < AgentAudioVisualizerGridProps > = {
7382 args : {
74- className :
75- 'gap-4 *:size-1 *:rounded-full *:bg-foreground/10 [&_>_[data-lk-highlighted=true]]:bg-foreground [&_>_[data-lk-highlighted=true]]:scale-125 [&_>_[data-lk-highlighted=true]]:shadow-[0px_0px_10px_2px_rgba(255,255,255,0.4)]' ,
83+ className : 'gap-4' ,
84+ children : (
85+ < div
86+ className = { cn (
87+ AgentAudioVisualizerGridCellVariants ( { size : 'md' } ) ,
88+ 'data-[lk-highlighted=true]:bg-foreground data-[lk-highlighted=true]:scale-125' ,
89+ 'shadow-[0_0_10px_2px_transparent] data-[lk-highlighted=true]:shadow-[0_0_10px_2px_var(--tw-shadow-color,currentColor)]' ,
90+ ) }
91+ />
92+ ) ,
7693 } ,
7794} ;
7895
7996export const Demo2 : StoryObj < AgentAudioVisualizerGridProps > = {
8097 args : {
81- className :
82- 'gap-2 *:w-4 *:h-1 *:bg-foreground/10 [&_>_[data-lk-highlighted=true]]:bg-[#F9B11F] [&_>_[data-lk-highlighted=true]]:shadow-[0px_0px_14.8px_2px_#F9B11F]' ,
98+ color : '#F9B11F' ,
99+ className : 'gap-2' ,
100+ children : (
101+ < div
102+ className = { cn (
103+ AgentAudioVisualizerGridCellVariants ( { size : 'md' } ) ,
104+ 'w-4 h-1 bg-foreground/10' ,
105+ 'shadow-[0_0_10px_2px_transparent] data-[lk-highlighted=true]:shadow-[0_0_10px_2px_var(--tw-shadow-color,currentColor)]' ,
106+ ) }
107+ />
108+ ) ,
83109 } ,
84110} ;
85111
86112export const Demo3 : StoryObj < AgentAudioVisualizerGridProps > = {
87113 args : {
88- className :
89- 'gap-4 *:size-2 *:rounded-full *:bg-foreground/10 [&_>_[data-lk-highlighted=true]]:bg-[#1F8CF9] [&_>_[data-lk-highlighted=true]]:shadow-[0px_0px_14.8px_2px_#1F8CF9]' ,
90- transformer : ( index : number , rowCount : number , columnCount : number ) => {
91- const rowMidPoint = Math . floor ( rowCount / 2 ) ;
92- const distanceFromCenter = Math . sqrt (
93- Math . pow ( rowMidPoint - ( index % columnCount ) , 2 ) +
94- Math . pow ( rowMidPoint - Math . floor ( index / columnCount ) , 2 ) ,
95- ) ;
96-
97- return {
98- opacity : 1 - distanceFromCenter / columnCount ,
99- transform : `scale(${ 1 - ( distanceFromCenter / ( columnCount * 2 ) ) * 1.75 } )` ,
100- } ;
101- } ,
114+ color : '#1F8CF9' ,
115+ className : 'gap-4' ,
116+ children : (
117+ < div
118+ className = { cn (
119+ AgentAudioVisualizerGridCellVariants ( { size : 'md' } ) ,
120+ 'size-2 rounded-full bg-foreground/10' ,
121+ 'shadow-[0_0_10px_2px_transparent] data-[lk-highlighted=true]:shadow-[0_0_10px_2px_var(--tw-shadow-color,currentColor)]' ,
122+ ) }
123+ />
124+ ) ,
102125 } ,
103126} ;
104127
105128export const Demo4 : StoryObj < AgentAudioVisualizerGridProps > = {
106129 args : {
107- className :
108- 'gap-x-2.5 gap-y-1 *:w-3 *:h-px *:my-2 *:rotate-45 *:bg-foreground/10 *:rotate-45 *:scale-100 [&_>_[data-lk-highlighted=true]]:bg-[#FFB6C1] [&_>_[data-lk-highlighted=true]]:shadow-[0px_0px_8px_2px_rgba(255,182,193,0.4)] [&_>_[data-lk-highlighted=true]]:rotate-[405deg] [&_>_[data-lk-highlighted=true]]:scale-200' ,
130+ color : '#FFB6C1' ,
131+ className : 'gap-x-2.5 gap-y-1' ,
132+ children : (
133+ < div
134+ className = { cn (
135+ AgentAudioVisualizerGridCellVariants ( { size : 'md' } ) ,
136+ 'w-3 h-px my-2 rotate-45 bg-foreground/10 scale-100' ,
137+ 'data-[lk-highlighted=true]:rotate-405 data-[lk-highlighted=true]:scale-200' ,
138+ 'shadow-[0_0_10px_2px_transparent] data-[lk-highlighted=true]:shadow-[0_0_10px_2px_var(--tw-shadow-color,currentColor)]' ,
139+ ) }
140+ />
141+ ) ,
109142 } ,
110143} ;
0 commit comments