diff --git a/app/soapbox/features/ui/components/accordion.tsx b/app/soapbox/components/ui/accordion/accordion.tsx similarity index 50% rename from app/soapbox/features/ui/components/accordion.tsx rename to app/soapbox/components/ui/accordion/accordion.tsx index bf6938c70..299848d84 100644 --- a/app/soapbox/features/ui/components/accordion.tsx +++ b/app/soapbox/components/ui/accordion/accordion.tsx @@ -2,7 +2,7 @@ import classNames from 'clsx'; import React from 'react'; import { defineMessages, useIntl } from 'react-intl'; -import { Text } from 'soapbox/components/ui'; +import { HStack, Icon, Text } from 'soapbox/components/ui'; import DropdownMenu from 'soapbox/containers/dropdown-menu-container'; import type { Menu } from 'soapbox/components/dropdown-menu'; @@ -20,6 +20,10 @@ interface IAccordion { onToggle?: (value: boolean) => void, } +/** + * Accordion + * An accordion is a vertically stacked group of collapsible sections. + */ const Accordion: React.FC = ({ headline, children, menu, expanded = false, onToggle = () => {} }) => { const intl = useIntl(); @@ -29,21 +33,38 @@ const Accordion: React.FC = ({ headline, children, menu, expanded = }; return ( -
- {menu && ( -
- -
- )} +
-
+ +
{children}
diff --git a/app/soapbox/components/ui/index.ts b/app/soapbox/components/ui/index.ts index fd9cb055e..c7d4c7e4f 100644 --- a/app/soapbox/components/ui/index.ts +++ b/app/soapbox/components/ui/index.ts @@ -1,3 +1,4 @@ +export { default as Accordion } from './accordion/accordion'; export { default as Avatar } from './avatar/avatar'; export { default as Banner } from './banner/banner'; export { default as Button } from './button/button'; diff --git a/app/soapbox/features/admin/components/report.tsx b/app/soapbox/features/admin/components/report.tsx index 3304a17a9..4c37b7b61 100644 --- a/app/soapbox/features/admin/components/report.tsx +++ b/app/soapbox/features/admin/components/report.tsx @@ -7,9 +7,8 @@ import { deactivateUserModal, deleteUserModal } from 'soapbox/actions/moderation import snackbar from 'soapbox/actions/snackbar'; import Avatar from 'soapbox/components/avatar'; import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper'; -import { Button, HStack } from 'soapbox/components/ui'; +import { Accordion, Button, HStack } from 'soapbox/components/ui'; import DropdownMenu from 'soapbox/containers/dropdown-menu-container'; -import Accordion from 'soapbox/features/ui/components/accordion'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import { makeGetReport } from 'soapbox/selectors'; diff --git a/app/soapbox/features/crypto-donate/index.tsx b/app/soapbox/features/crypto-donate/index.tsx index acc935e6f..820124b9d 100644 --- a/app/soapbox/features/crypto-donate/index.tsx +++ b/app/soapbox/features/crypto-donate/index.tsx @@ -1,8 +1,7 @@ import React, { useState } from 'react'; import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; -import { Column, Stack } from 'soapbox/components/ui'; -import Accordion from 'soapbox/features/ui/components/accordion'; +import { Accordion, Column, Stack } from 'soapbox/components/ui'; import { useAppSelector } from 'soapbox/hooks'; import SiteWallet from './components/site-wallet'; diff --git a/app/soapbox/features/federation-restrictions/index.tsx b/app/soapbox/features/federation-restrictions/index.tsx index f7b317822..fae7994cb 100644 --- a/app/soapbox/features/federation-restrictions/index.tsx +++ b/app/soapbox/features/federation-restrictions/index.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import ScrollableList from 'soapbox/components/scrollable-list'; -import Accordion from 'soapbox/features/ui/components/accordion'; +import { Accordion } from 'soapbox/components/ui'; import { useAppSelector } from 'soapbox/hooks'; import { makeGetHosts } from 'soapbox/selectors'; import { federationRestrictionsDisclosed } from 'soapbox/utils/state'; diff --git a/app/soapbox/features/public-timeline/index.tsx b/app/soapbox/features/public-timeline/index.tsx index ae9378ba3..6fec372ce 100644 --- a/app/soapbox/features/public-timeline/index.tsx +++ b/app/soapbox/features/public-timeline/index.tsx @@ -7,8 +7,7 @@ import { connectPublicStream } from 'soapbox/actions/streaming'; import { expandPublicTimeline } from 'soapbox/actions/timelines'; import PullToRefresh from 'soapbox/components/pull-to-refresh'; import SubNavigation from 'soapbox/components/sub-navigation'; -import { Column } from 'soapbox/components/ui'; -import Accordion from 'soapbox/features/ui/components/accordion'; +import { Accordion, Column } from 'soapbox/components/ui'; import { useAppDispatch, useAppSelector, useSettings } from 'soapbox/hooks'; import PinnedHostsPicker from '../remote-timeline/components/pinned-hosts-picker'; diff --git a/app/soapbox/features/soapbox-config/index.tsx b/app/soapbox/features/soapbox-config/index.tsx index 222c44434..72cd1de7d 100644 --- a/app/soapbox/features/soapbox-config/index.tsx +++ b/app/soapbox/features/soapbox-config/index.tsx @@ -7,6 +7,7 @@ import { uploadMedia } from 'soapbox/actions/media'; import snackbar from 'soapbox/actions/snackbar'; import List, { ListItem } from 'soapbox/components/list'; import { + Accordion, Column, CardHeader, CardTitle, @@ -24,8 +25,6 @@ import ThemeSelector from 'soapbox/features/ui/components/theme-selector'; import { useAppSelector, useAppDispatch } from 'soapbox/hooks'; import { normalizeSoapboxConfig } from 'soapbox/normalizers'; -import Accordion from '../ui/components/accordion'; - import ColorWithPicker from './components/color-with-picker'; import CryptoAddressInput from './components/crypto-address-input'; import FooterLinkInput from './components/footer-link-input'; diff --git a/app/styles/application.scss b/app/styles/application.scss index ff5a0ab0c..d96a607f8 100644 --- a/app/styles/application.scss +++ b/app/styles/application.scss @@ -60,7 +60,6 @@ @import 'components/profile-hover-card'; @import 'components/filters'; @import 'components/snackbar'; -@import 'components/accordion'; @import 'components/admin'; @import 'components/backups'; @import 'components/crypto-donate'; diff --git a/app/styles/components/accordion.scss b/app/styles/components/accordion.scss deleted file mode 100644 index 77c39ae1e..000000000 --- a/app/styles/components/accordion.scss +++ /dev/null @@ -1,71 +0,0 @@ -.explanation-box { - padding: 5px 20px; -} - -.accordion { - @apply text-black dark:text-white bg-gray-100 dark:bg-gray-900; - padding: 15px 20px; - font-size: 14px; - border-radius: 8px; - margin: 0; - position: relative; - - &__title { - font-weight: bold !important; - font-size: 16px !important; - background: transparent !important; - color: var(--primary-text-color) !important; - padding: 0 !important; - margin: 0 !important; - text-transform: none !important; - text-align: left !important; - display: flex !important; - align-items: center; - border: 0; - width: 100%; - - &::after { - @apply text-black dark:text-white; - content: ''; - display: block; - font-family: 'Font Awesome 5 Free'; - font-weight: 900; - font-size: 0.8em; - padding-left: 0.6em; - margin-left: auto; - } - } - - &__menu { - position: absolute; - top: 17px; - right: 40px; - } - - &__content { - height: 0; - overflow: hidden; - } - - &--expanded &__title { - margin-bottom: 10px !important; - - &::after { - @apply text-black dark:text-white; - content: ''; - } - } - - &--expanded &__content { - height: auto; - } - - a { - color: var(--brand-color--hicontrast); - text-decoration: underline; - - &:hover { - text-decoration: none; - } - } -} diff --git a/app/styles/components/admin.scss b/app/styles/components/admin.scss index 6c6fb42fa..302baa4e1 100644 --- a/app/styles/components/admin.scss +++ b/app/styles/components/admin.scss @@ -111,17 +111,6 @@ } } - &__statuses .accordion { - padding: 10px; - margin-bottom: 6px; - - &__title { - font-size: 12px !important; - font-weight: normal !important; - margin-bottom: 0 !important; - } - } - &__status-content { overflow: hidden; } diff --git a/app/styles/components/columns.scss b/app/styles/components/columns.scss index 5ac761946..454c73cbd 100644 --- a/app/styles/components/columns.scss +++ b/app/styles/components/columns.scss @@ -719,10 +719,6 @@ font-size: 20px; } -.column .explanation-box { - background: var(--foreground-color); -} - // Pull to refresh .columns-area .column { .ptr,