diff --git a/src/components/Text/cmp.builder.tsx b/src/components/Text/cmp.builder.tsx index eb5b9a0..6c9bf51 100644 --- a/src/components/Text/cmp.builder.tsx +++ b/src/components/Text/cmp.builder.tsx @@ -3,7 +3,7 @@ import { TEXT_PROPS } from "@/constants/builderProps"; import Text from "."; import { CSS_EDITABLE_INPUTS_ADVANCED } from "@/constants/builderInputs"; -const filteredTextInputs = TEXT_PROPS.inputs.filter((input) => { +export const filteredTextInputs = TEXT_PROPS.inputs.filter((input) => { return input.name !== "children"; }); diff --git a/src/components/ToggleContainer/cmp.builder.tsx b/src/components/ToggleContainer/cmp.builder.tsx index 8710a33..03ac251 100644 --- a/src/components/ToggleContainer/cmp.builder.tsx +++ b/src/components/ToggleContainer/cmp.builder.tsx @@ -1,6 +1,8 @@ import { Builder, withChildren } from "@builder.io/react"; -import { DEFAULT_PROPS } from "@/constants/builderProps"; +import { DEFAULT_PROPS, TEXT_PROPS } from "@/constants/builderProps"; import ToggleContainer from "."; +import { CSS_EDITABLE_INPUTS_ADVANCED } from "@/constants/builderInputs"; +import { filteredTextInputs } from "../Text/cmp.builder"; Builder.registerComponent(withChildren(ToggleContainer), { ...DEFAULT_PROPS, @@ -8,7 +10,23 @@ Builder.registerComponent(withChildren(ToggleContainer), { canHaveChildren: true, inputs: [ ...DEFAULT_PROPS.inputs, - { name: "title", type: "string", defaultValue: "Toggle Container" }, { name: "noisyContainer", type: "boolean", defaultValue: true }, + { + name: "titleText", + type: "richText", + defaultValue: "Toggle container title", + }, + { + name: "titleClosedStyles", + friendlyName: "Title styles when closed", + type: "object", + subFields: [...filteredTextInputs, ...CSS_EDITABLE_INPUTS_ADVANCED], + }, + { + name: "titleOpenedStyles", + friendlyName: "Title styles when opened", + type: "object", + subFields: [...filteredTextInputs, ...CSS_EDITABLE_INPUTS_ADVANCED], + }, ], }); diff --git a/src/components/ToggleContainer/cmp.tsx b/src/components/ToggleContainer/cmp.tsx index e380eaf..587cd4d 100644 --- a/src/components/ToggleContainer/cmp.tsx +++ b/src/components/ToggleContainer/cmp.tsx @@ -5,9 +5,12 @@ import { import { ToggleContainerProps } from "./types"; import { memo, useCallback, useState } from "react"; import { StyledIcon, StyledPlainContainer, StyledTitle } from "./styles"; +import Text from "../Text"; export const ToggleContainer = ({ - title, + titleText, + titleClosedStyles, + titleOpenedStyles = titleClosedStyles, noisyContainer, children, }: ToggleContainerProps) => { @@ -19,16 +22,13 @@ export const ToggleContainer = ({ ); const Container = noisyContainer ? NoisyContainer : StyledPlainContainer; - + const textProps = open ? titleOpenedStyles : titleClosedStyles; return (
- - {title} - +
+ titleText +