@@ -61,7 +61,7 @@ impl super::Story for ButtonStory {
6161 false
6262 }
6363
64- fn new_view ( window : & mut Window , cx : & mut App ) -> Entity < impl Render + Focusable > {
64+ fn new_view ( window : & mut Window , cx : & mut App ) -> Entity < impl Render > {
6565 Self :: view ( window, cx)
6666 }
6767}
@@ -599,8 +599,8 @@ impl Render for ButtonStory {
599599 ) ,
600600 )
601601 . child (
602- section (
603- h_flex ( ) . gap_2 ( ) . child ( "Toggle Button Group" ) . child (
602+ section ( "Toggle Button Group" )
603+ . sub_title (
604604 Checkbox :: new ( "multiple-button" )
605605 . text_sm ( )
606606 . label ( "Multiple" )
@@ -609,41 +609,40 @@ impl Render for ButtonStory {
609609 view. toggle_multiple = !view. toggle_multiple ;
610610 cx. notify ( ) ;
611611 } ) ) ,
612+ )
613+ . child (
614+ ButtonGroup :: new ( "toggle-button-group" )
615+ . outline ( )
616+ . compact ( )
617+ . multiple ( toggle_multiple)
618+ . child (
619+ Button :: new ( "disabled-toggle-button" )
620+ . label ( "Disabled" )
621+ . selected ( disabled) ,
622+ )
623+ . child (
624+ Button :: new ( "loading-toggle-button" )
625+ . label ( "Loading" )
626+ . selected ( loading) ,
627+ )
628+ . child (
629+ Button :: new ( "selected-toggle-button" )
630+ . label ( "Selected" )
631+ . selected ( selected) ,
632+ )
633+ . child (
634+ Button :: new ( "compact-toggle-button" )
635+ . label ( "Compact" )
636+ . selected ( compact) ,
637+ )
638+ . on_click ( cx. listener ( |view, selected : & Vec < usize > , _, cx| {
639+ view. disabled = selected. contains ( & 0 ) ;
640+ view. loading = selected. contains ( & 1 ) ;
641+ view. selected = selected. contains ( & 2 ) ;
642+ view. compact = selected. contains ( & 3 ) ;
643+ cx. notify ( ) ;
644+ } ) ) ,
612645 ) ,
613- )
614- . child (
615- ButtonGroup :: new ( "toggle-button-group" )
616- . outline ( )
617- . compact ( )
618- . multiple ( toggle_multiple)
619- . child (
620- Button :: new ( "disabled-toggle-button" )
621- . label ( "Disabled" )
622- . selected ( disabled) ,
623- )
624- . child (
625- Button :: new ( "loading-toggle-button" )
626- . label ( "Loading" )
627- . selected ( loading) ,
628- )
629- . child (
630- Button :: new ( "selected-toggle-button" )
631- . label ( "Selected" )
632- . selected ( selected) ,
633- )
634- . child (
635- Button :: new ( "compact-toggle-button" )
636- . label ( "Compact" )
637- . selected ( compact) ,
638- )
639- . on_click ( cx. listener ( |view, selected : & Vec < usize > , _, cx| {
640- view. disabled = selected. contains ( & 0 ) ;
641- view. loading = selected. contains ( & 1 ) ;
642- view. selected = selected. contains ( & 2 ) ;
643- view. compact = selected. contains ( & 3 ) ;
644- cx. notify ( ) ;
645- } ) ) ,
646- ) ,
647646 )
648647 . child (
649648 section ( "Dropdown Button" )
0 commit comments