diff --git a/packages/slate-editor/src/components/Accordion/Accordion.module.scss b/packages/slate-editor/src/components/Accordion/Accordion.module.scss new file mode 100644 index 000000000..d0266bb63 --- /dev/null +++ b/packages/slate-editor/src/components/Accordion/Accordion.module.scss @@ -0,0 +1,37 @@ +@import "styles/variables"; +@import "styles/helpers"; + +.Accordion { + border-top: 1px solid rgba($color: $white, $alpha: 0.12); +} + +.button { + @include btn-unstyled; + + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + padding: $spacing-2; + color: $grey-300; + font-size: $font-size-small; + font-weight: 600; +} + +.content { + display: none; + padding: 0 $spacing-2 $spacing-2; + + &.open { + display: block; + } +} + +.icon { + fill: $white; + transition: transform 0.3s ease-in; + + &.open { + transform: rotate(180deg); + } +} diff --git a/packages/slate-editor/src/components/Accordion/Accordion.tsx b/packages/slate-editor/src/components/Accordion/Accordion.tsx new file mode 100644 index 000000000..ee1f02b5d --- /dev/null +++ b/packages/slate-editor/src/components/Accordion/Accordion.tsx @@ -0,0 +1,41 @@ +import classNames from 'classnames'; +import React, { useState, type ReactNode } from 'react'; + +import { Caret } from '#icons'; + +import styles from './Accordion.module.scss'; + +interface Props { + title: string; + children: ReactNode; +} + +export function Accordion({ title, children }: Props) { + const [isOpen, setIsOpen] = useState(false); + + function toggleOpen() { + setIsOpen(!isOpen); + } + + return ( +
+ +
+ {children} +
+
+ ); +} diff --git a/packages/slate-editor/src/components/Accordion/index.ts b/packages/slate-editor/src/components/Accordion/index.ts new file mode 100644 index 000000000..feee0c4f0 --- /dev/null +++ b/packages/slate-editor/src/components/Accordion/index.ts @@ -0,0 +1 @@ +export { Accordion } from './Accordion'; diff --git a/packages/slate-editor/src/components/index.ts b/packages/slate-editor/src/components/index.ts index 2678175ca..69372047a 100644 --- a/packages/slate-editor/src/components/index.ts +++ b/packages/slate-editor/src/components/index.ts @@ -1,3 +1,4 @@ +export { Accordion } from './Accordion'; export { Avatar } from './Avatar'; export { CloseButtonV2 } from './CloseButtonV2'; export { CloseButton, EditorBlock, ResizableEditorBlock } from './EditorBlock'; diff --git a/packages/slate-editor/src/extensions/button-block/components/ButtonBlockMenu.tsx b/packages/slate-editor/src/extensions/button-block/components/ButtonBlockMenu.tsx index bc9dba5ec..8e919cc42 100644 --- a/packages/slate-editor/src/extensions/button-block/components/ButtonBlockMenu.tsx +++ b/packages/slate-editor/src/extensions/button-block/components/ButtonBlockMenu.tsx @@ -2,6 +2,7 @@ import classNames from 'classnames'; import React, { useCallback, useEffect, useState } from 'react'; import { + Accordion, Button, Input, type OptionsGroupOption, @@ -166,18 +167,15 @@ export function ButtonMenu({ onUpdate, onClose, onRemove, value, withNewTabOptio - + - - Styling options - onUpdate({ variant })} - options={BUTTON_MENU_VARIANT_OPTIONS} - selectedValue={value.variant} - variant="pills" - /> - + onUpdate({ variant })} + options={BUTTON_MENU_VARIANT_OPTIONS} + selectedValue={value.variant} + variant="pills" + /> Alignment @@ -189,7 +187,7 @@ export function ButtonMenu({ onUpdate, onClose, onRemove, value, withNewTabOptio /> - +