@@ -716,35 +716,60 @@ fn ComponentDemo(iframe: Option<bool>, dark_mode: Option<bool>, name: String) ->
716716#[ component]
717717fn ComponentHighlight ( demo : ComponentDemoData ) -> Element {
718718 let ComponentDemoData {
719- name,
719+ name : raw_name ,
720720 docs,
721721 variants,
722722 component,
723723 style,
724724 } = demo;
725- let name = name . replace ( "_" , " " ) ;
725+ let name = raw_name . replace ( "_" , " " ) ;
726726 let [ main, variants @ ..] = variants else {
727727 unreachable ! ( "Expected at least one variant for component: {}" , name) ;
728728 } ;
729729
730730 rsx ! {
731731 main { class: "component-demo" ,
732- h1 { class: "component-title" , { name} }
732+ h1 { class: "component-title" , " {name}" }
733733 div { class: "component-preview" ,
734734 div { class: "component-preview-contents" ,
735735 ComponentVariantHighlight { variant: main. clone( ) , main_variant: true }
736736 div { class: "component-installation" ,
737737 h2 { "Installation" }
738- ol { class: "component-installation-list" ,
739- li {
740- "If you haven't already, add the dx-components-theme.css file to your project and import it in the root of your app."
738+ Tabs {
739+ default_value: "Automatic" ,
740+ border_bottom_left_radius: "0.5rem" ,
741+ border_bottom_right_radius: "0.5rem" ,
742+ horizontal: true ,
743+ width: "100%" ,
744+ variant: TabsVariant :: Ghost ,
745+ TabList {
746+ TabTrigger { value: "Automatic" , index: 0usize , "Automatic" }
747+ TabTrigger { value: "Manual" , index: 1usize , "Manual" }
748+ }
749+ div {
750+ width: "100%" ,
751+ height: "100%" ,
752+ display: "flex" ,
753+ flex_direction: "column" ,
754+ justify_content: "center" ,
755+ align_items: "center" ,
756+ TabContent {
757+ index: 0usize ,
758+ value: "Automatic" ,
759+ width: "100%" ,
760+ position: "relative" ,
761+ CliComponentInstallation { name: raw_name }
762+ }
763+ TabContent {
764+ index: 1usize ,
765+ value: "Manual" ,
766+ width: "100%" ,
767+ position: "relative" ,
768+ ManualComponentInstallation { component, style }
769+ }
741770 }
742- li { "Add the style.css file to your project." }
743- li { "Create a component based on the main.rs below." }
744- li { "Modify your components and styles as needed." }
745771 }
746772 }
747- ComponentCode { rs_highlighted: component, css_highlighted: style }
748773 div { class: "component-description" ,
749774 div { dangerous_inner_html: docs }
750775 }
@@ -760,6 +785,59 @@ fn ComponentHighlight(demo: ComponentDemoData) -> Element {
760785 }
761786}
762787
788+ #[ component]
789+ fn ManualComponentInstallation ( component : HighlightedCode , style : HighlightedCode ) -> Element {
790+ rsx ! {
791+ ol { class: "component-installation-list" ,
792+ li {
793+ "If you haven't already, add the dx-components-theme.css file to your project and import it in the root of your app."
794+ }
795+ li { "Add the style.css file to your project." }
796+ li { "Create a component based on the main.rs below." }
797+ li { "Modify your components and styles as needed." }
798+ }
799+ ComponentCode { rs_highlighted: component, css_highlighted: style }
800+ }
801+ }
802+
803+ #[ component]
804+ fn CliComponentInstallation ( name : String ) -> Element {
805+ rsx ! {
806+ ol { class: "component-installation-list" ,
807+ li {
808+ "Install the 0.7.0-rc.3 version of the CLI manually (without binstall)"
809+ div { id: "hero-installation" ,
810+ "> "
811+ div {
812+ width: "100%" ,
813+ display: "flex" ,
814+ flex_direction: "row" ,
815+ justify_content: "space-between" ,
816+ align_items: "center" ,
817+ 818+ CopyButton { }
819+ }
820+ }
821+ }
822+ li {
823+ "Add the component to your project using the dx components add command:"
824+ div { id: "hero-installation" ,
825+ "> "
826+ div {
827+ width: "100%" ,
828+ display: "flex" ,
829+ flex_direction: "row" ,
830+ justify_content: "space-between" ,
831+ align_items: "center" ,
832+ "dx components add {name}"
833+ CopyButton { }
834+ }
835+ }
836+ }
837+ }
838+ }
839+ }
840+
763841#[ component]
764842fn ComponentVariantHighlight ( variant : ComponentVariantDemoData , main_variant : bool ) -> Element {
765843 let ComponentVariantDemoData {
0 commit comments