11import cs from 'classnames' ;
22import { useAtom , useAtomValue , useSetAtom } from 'jotai' ;
3+ import DiscordIconSvg from '../assets/discord-icon.svg' ;
4+ import GithubIconSvg from '../assets/github-icon.svg' ;
35import { useId , useState } from 'react' ;
46import { runWithCatchAtom } from '../utils/examples/currentSnackbarAtom.ts' ;
57import {
@@ -86,7 +88,7 @@ function SliderRow({
8688 ) ;
8789}
8890
89- function VectorSliderRow ( {
91+ function VectorSliderRow < T extends d . v2f | d . v3f | d . v4f > ( {
9092 label,
9193 initial,
9294 min,
@@ -95,13 +97,13 @@ function VectorSliderRow({
9597 onChange,
9698} : {
9799 label : string ;
98- initial : number [ ] ;
99- min : number [ ] ;
100- max : number [ ] ;
101- step : number [ ] ;
102- onChange : ( value : number [ ] ) => void ;
100+ initial : T ;
101+ min : T ;
102+ max : T ;
103+ step : T ;
104+ onChange : ( value : T ) => void ;
103105} ) {
104- const [ value , setValue ] = useState < number [ ] > ( initial ?? min ) ;
106+ const [ value , setValue ] = useState < T > ( initial ) ;
105107 const runWithCatch = useSetAtom ( runWithCatchAtom ) ;
106108
107109 return (
@@ -114,8 +116,8 @@ function VectorSliderRow({
114116 step = { step }
115117 value = { value }
116118 onChange = { ( newValue ) => {
117- setValue ( newValue ) ;
118- void runWithCatch ( ( ) => onChange ( newValue ) ) ;
119+ setValue ( newValue as T ) ;
120+ void runWithCatch ( ( ) => onChange ( newValue as T ) ) ;
119121 } }
120122 />
121123 </ >
@@ -246,7 +248,7 @@ function paramToControlRow(param: ExampleControlParam) {
246248 < VectorSliderRow
247249 key = { param . label }
248250 label = { param . label }
249- onChange = { param . onVectorSliderChange }
251+ onChange = { param . onVectorSliderChange as ( value : d . v2f | d . v3f | d . v4f ) => void }
250252 min = { param . min }
251253 max = { param . max }
252254 step = { param . step }
@@ -328,6 +330,18 @@ export function ControlPanel() {
328330 </ div >
329331 </ >
330332 ) }
333+
334+ < div className = "mt-auto hidden items-center justify-between pt-2 text-tameplum-800 text-xs md:flex" >
335+ < div > © { new Date ( ) . getFullYear ( ) } Software Mansion S.A.</ div >
336+ < div className = "flex items-center gap-3" >
337+ < a href = "https://discord.gg/8jpfgDqPcM" target = "_blank" rel = "noreferrer" >
338+ < img src = { DiscordIconSvg . src } className = "opacity-75" alt = "discord logo" />
339+ </ a >
340+ < a href = "https://github.com/software-mansion/TypeGPU" target = "_blank" rel = "noreferrer" >
341+ < img src = { GithubIconSvg . src } className = "opacity-75" alt = "github logo" />
342+ </ a >
343+ </ div >
344+ </ div >
331345 </ div >
332346 ) ;
333347}
0 commit comments