@@ -31,16 +31,18 @@ const views: ButtonView[] = [
3131 'flat-contrast' ,
3232] ;
3333
34- function viewSelect ( name : string ) {
34+ function selectControl < T > ( name : string , options : T [ ] ) {
3535 return {
3636 name,
3737 control : 'select' as const ,
38- defaultValue : 'outlined' ,
39- options : views ,
40- if : { arg : 'setActions' } ,
38+ options,
4139 } ;
4240}
4341
42+ function viewSelect ( name : string ) {
43+ return { ...selectControl ( name , views ) , defaultValue : 'outlined' , if : { arg : 'setActions' } } ;
44+ }
45+
4446const disabledControl = {
4547 table : {
4648 disable : true ,
@@ -95,6 +97,7 @@ export const Default: Story = {
9597 allowAutoHiding : booleanControl ( 'Allow auto hiding' ) ,
9698 setTitle : booleanControl ( 'Add title' ) ,
9799 setContent : booleanControl ( 'Add content' ) ,
100+ animation : selectControl ( 'Animation' , [ 'default' , 'alternate' ] ) ,
98101 setActions : booleanControl ( 'Add action' ) ,
99102 action1View : viewSelect ( 'Action 1 view' ) ,
100103 action2View : viewSelect ( 'Action 2 view' ) ,
@@ -123,6 +126,7 @@ export const ToastPlayground: Story = {
123126 actions : faker . helpers . uniqueArray ( getAction , faker . number . int ( { min : 1 , max : 2 } ) ) ,
124127 } ,
125128 argTypes : {
129+ animation : selectControl ( 'Animation' , [ 'default' , 'alternate' ] ) ,
126130 name : disabledControl ,
127131 addedAt : disabledControl ,
128132 renderIcon : disabledControl ,
@@ -145,6 +149,7 @@ export const ToastPlayground: Story = {
145149 < ToasterComponent
146150 mobile = { args . mobile }
147151 hasPortal = { context . globals . screenshotTests !== true }
152+ alternateAnimationFunction = { args . animation === 'alternate' }
148153 />
149154 ) ;
150155 } ,
0 commit comments