AdminX Design System component structure cleanup

refs. https://github.com/TryGhost/Team/issues/3432
This commit is contained in:
Peter Zimon 2023-06-14 08:35:05 +02:00
parent 24ea03b3fe
commit 8820efa80b
54 changed files with 94 additions and 93 deletions

View File

@ -14,7 +14,8 @@ const preview: Preview = {
},
options: {
storySort: {
order: ['Global', 'Settings', 'Experimental'],
mathod: 'alphabetical',
order: ['Global', ['Chrome', 'Form', 'Modal', 'List', '*'], 'Settings', ['Setting Section', 'Setting Group', '*'], 'Experimental'],
},
},
},

View File

@ -1,10 +1,10 @@
import type {Meta, StoryObj} from '@storybook/react';
import Button from './Button';
import ButtonGroup from './ButtonGroup';
import Button from '../Button';
import ButtonGroup from '../ButtonGroup';
import DesktopChromeHeader from './DesktopChromeHeader';
import URLSelect from './URLSelect';
import {SelectOption} from './Select';
import URLSelect from '../form/URLSelect';
import {SelectOption} from '../form/Select';
const meta = {
title: 'Global / Chrome / Desktop Header',

View File

@ -3,7 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import Checkbox from './Checkbox';
const meta = {
title: 'Global / Checkbox',
title: 'Global / Form / Checkbox',
component: Checkbox,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '400px'}}>{_story()}</div>)],

View File

@ -1,7 +1,7 @@
import Heading from './Heading';
import Hint from './Hint';
import Heading from '../Heading';
import Hint from '../Hint';
import React, {useEffect, useState} from 'react';
import Separator from './Separator';
import Separator from '../Separator';
interface CheckboxProps {
id: string;

View File

@ -3,7 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import FileUpload from './FileUpload';
const meta = {
title: 'Global / File Upload',
title: 'Global / Form / File Upload',
component: FileUpload,
tags: ['autodocs']
} satisfies Meta<typeof FileUpload>;

View File

@ -3,7 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import ImageUpload from './ImageUpload';
const meta = {
title: 'Global / Image upload',
title: 'Global / Form / Image upload',
component: ImageUpload,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '600px'}}>{_story()}</div>)]

View File

@ -1,5 +1,5 @@
import FileUpload from './FileUpload';
import Icon from './Icon';
import Icon from '../Icon';
import React from 'react';
import clsx from 'clsx';

View File

@ -4,7 +4,7 @@ import MultiSelect, {MultiSelectOption} from './MultiSelect';
import {MultiValue} from 'react-select';
const meta = {
title: 'Global / Select / Multiselect',
title: 'Global / Form / Multiselect',
component: MultiSelect,
tags: ['autodocs']
} satisfies Meta<typeof MultiSelect>;

View File

@ -1,5 +1,5 @@
import Heading from './Heading';
import Hint from './Hint';
import Heading from '../Heading';
import Hint from '../Hint';
import React from 'react';
import {GroupBase, MultiValue, OptionsOrGroups, default as ReactSelect, components} from 'react-select';

View File

@ -4,7 +4,7 @@ import Radio from './Radio';
import {RadioOption} from './Radio';
const meta = {
title: 'Global / Radio',
title: 'Global / Form / Radio',
component: Radio,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '400px'}}>{_story()}</div>)],

View File

@ -1,7 +1,7 @@
import Heading from './Heading';
import Hint from './Hint';
import Heading from '../Heading';
import Hint from '../Hint';
import React, {useEffect, useState} from 'react';
import Separator from './Separator';
import Separator from '../Separator';
export interface RadioOption {
value: string;

View File

@ -4,7 +4,7 @@ import Select from './Select';
import {SelectOption} from './Select';
const meta = {
title: 'Global / Select / Simple select',
title: 'Global / Simple select',
component: Select,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '400px'}}>{_story()}</div>)],

View File

@ -1,7 +1,7 @@
import React, {useEffect, useId, useState} from 'react';
import Heading from './Heading';
import Hint from './Hint';
import Heading from '../Heading';
import Hint from '../Hint';
import clsx from 'clsx';
export interface SelectOption {

View File

@ -3,7 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import TextArea from './TextArea';
const meta = {
title: 'Global / Textarea',
title: 'Global / Form / Textarea',
component: TextArea,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '400px'}}>{_story()}</div>)],

View File

@ -1,7 +1,7 @@
import React, {useId} from 'react';
import Heading from './Heading';
import Hint from './Hint';
import Heading from '../Heading';
import Hint from '../Hint';
type ResizeOptions = 'both' | 'vertical' | 'horizontal' | 'none';

View File

@ -3,7 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import TextField from './TextField';
const meta = {
title: 'Global / Textfield',
title: 'Global / Form / Textfield',
component: TextField,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '400px'}}>{_story()}</div>)],

View File

@ -1,5 +1,5 @@
import Heading from './Heading';
import Hint from './Hint';
import Heading from '../Heading';
import Hint from '../Hint';
import React, {useId} from 'react';
import clsx from 'clsx';

View File

@ -3,7 +3,7 @@ import type {Meta, StoryObj} from '@storybook/react';
import Toggle from './Toggle';
const meta = {
title: 'Global / Toggle',
title: 'Global / Form / Toggle',
component: Toggle,
tags: ['autodocs'],
decorators: [(_story: any) => (<div style={{maxWidth: '400px'}}>{_story()}</div>)]

View File

@ -1,5 +1,5 @@
import React from 'react';
import Separator from './Separator';
import Separator from '../Separator';
type ToggleSizes = 'sm' | 'md' | 'lg';
type ToggleDirections = 'ltr' | 'rtl';

View File

@ -4,7 +4,7 @@ import URLSelect from './URLSelect';
import {SelectOption} from './Select';
const meta = {
title: 'Global / Select / URL Select',
title: 'Global / Form / URL Select',
component: URLSelect,
tags: ['autodocs']
} satisfies Meta<typeof URLSelect>;

View File

@ -1,4 +1,4 @@
import Button from './Button';
import Button from '../Button';
import ConfirmationModal, {ConfirmationModalProps} from './ConfirmationModal';
import NiceModal from '@ebay/nice-modal-react';
import React from 'react';

View File

@ -1,8 +1,8 @@
import Button, {IButton} from './Button';
import ButtonGroup from './ButtonGroup';
import Heading from './Heading';
import Button, {IButton} from '../Button';
import ButtonGroup from '../ButtonGroup';
import Heading from '../Heading';
import React from 'react';
import StickyFooter from './StickyFooter';
import StickyFooter from '../StickyFooter';
import clsx from 'clsx';
import {useModal} from '@ebay/nice-modal-react';

View File

@ -1,7 +1,7 @@
import NiceModal from '@ebay/nice-modal-react';
import React from 'react';
import Button from './Button';
import Button from '../Button';
import Modal, {ModalProps} from './Modal';
const ModalContainer: React.FC<ModalProps> = ({children, onCancel, ...props}) => {

View File

@ -1,10 +1,10 @@
import type {Meta, StoryObj} from '@storybook/react';
import Heading from './Heading';
import Heading from '../Heading';
import NiceModal from '@ebay/nice-modal-react';
import PreviewModal from './PreviewModal';
import PreviewModalContainer from './PreviewModalContainer';
import {Tab} from './TabView';
import {Tab} from '../TabView';
const meta = {
title: 'Global / Modal / Preview Modal',

View File

@ -1,13 +1,13 @@
import ButtonGroup from './ButtonGroup';
import DesktopChromeHeader from './DesktopChromeHeader';
import Heading from './Heading';
import MobileChrome from './MobileChrome';
import ButtonGroup from '../ButtonGroup';
import DesktopChromeHeader from '../chrome/DesktopChromeHeader';
import Heading from '../Heading';
import MobileChrome from '../chrome/MobileChrome';
import Modal, {ModalSize} from './Modal';
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import React, {useState} from 'react';
import Select, {SelectOption} from './Select';
import TabView, {Tab} from './TabView';
import {IButton} from './Button';
import Select, {SelectOption} from '../form/Select';
import TabView, {Tab} from '../TabView';
import {IButton} from '../Button';
export interface PreviewModalProps {
testId?: string;

View File

@ -1,4 +1,4 @@
import Button from './Button';
import Button from '../Button';
import NiceModal from '@ebay/nice-modal-react';
import PreviewModal, {PreviewModalProps} from './PreviewModal';
import React from 'react';

View File

@ -3,8 +3,8 @@ import type {Meta, StoryObj} from '@storybook/react';
import SettingGroupContent from './SettingGroupContent';
import * as SettingValueStories from './SettingValue.stories';
import * as TextFieldStories from '../global/TextField.stories';
import TextField from '../global/TextField';
import * as TextFieldStories from '../global/form/TextField.stories';
import TextField from '../global/form/TextField';
const meta = {
title: 'Settings / Setting Group / Content',

View File

@ -1,6 +1,6 @@
import MultiSelect, {MultiSelectOption} from '../../../admin-x-ds/global/MultiSelect';
import MultiSelect, {MultiSelectOption} from '../../../admin-x-ds/global/form/MultiSelect';
import React, {useContext, useEffect, useState} from 'react';
import Select from '../../../admin-x-ds/global/Select';
import Select from '../../../admin-x-ds/global/form/Select';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import useSettingGroup from '../../../hooks/useSettingGroup';

View File

@ -1,10 +1,10 @@
import IconLabel from '../../../admin-x-ds/global/IconLabel';
import Link from '../../../admin-x-ds/global/Link';
import React from 'react';
import Select from '../../../admin-x-ds/global/Select';
import Select from '../../../admin-x-ds/global/form/Select';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../admin-x-ds/global/TextField';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -1,9 +1,9 @@
import ImageUpload from '../../../admin-x-ds/global/ImageUpload';
import ImageUpload from '../../../admin-x-ds/global/form/ImageUpload';
import React, {useContext} from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextArea from '../../../admin-x-ds/global/TextArea';
import TextField from '../../../admin-x-ds/global/TextField';
import TextArea from '../../../admin-x-ds/global/form/TextArea';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {ReactComponent as FacebookLogo} from '../../../admin-x-ds/assets/images/facebook-logo.svg';
import {FileService, ServicesContext} from '../../providers/ServiceProvider';

View File

@ -1,7 +1,7 @@
import Modal from '../../../admin-x-ds/global/Modal';
import Modal from '../../../admin-x-ds/global/modal/Modal';
import NiceModal from '@ebay/nice-modal-react';
import Radio from '../../../admin-x-ds/global/Radio';
import TextField from '../../../admin-x-ds/global/TextField';
import Radio from '../../../admin-x-ds/global/form/Radio';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useRoles from '../../../hooks/useRoles';
import useStaffUsers from '../../../hooks/useStaffUsers';
import validator from 'validator';

View File

@ -3,8 +3,8 @@ import Link from '../../../admin-x-ds/global/Link';
import React from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../admin-x-ds/global/TextField';
import Toggle from '../../../admin-x-ds/global/Toggle';
import TextField from '../../../admin-x-ds/global/form/TextField';
import Toggle from '../../../admin-x-ds/global/form/Toggle';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -2,7 +2,7 @@ import Heading from '../../../admin-x-ds/global/Heading';
import React from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../admin-x-ds/global/TextField';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {ReactComponent as GoogleLogo} from '../../../admin-x-ds/assets/images/google-logo.svg';
import {ReactComponent as MagnifyingGlass} from '../../../admin-x-ds/assets/icons/magnifying-glass.svg';

View File

@ -1,7 +1,7 @@
import React from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../admin-x-ds/global/TextField';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -1,7 +1,7 @@
import React, {useRef, useState} from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../admin-x-ds/global/TextField';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import validator from 'validator';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -1,5 +1,5 @@
import React, {useEffect, useState} from 'react';
import Select from '../../../admin-x-ds/global/Select';
import Select from '../../../admin-x-ds/global/form/Select';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import timezoneData from '@tryghost/timezone-data';

View File

@ -1,8 +1,8 @@
import React from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextArea from '../../../admin-x-ds/global/TextArea';
import TextField from '../../../admin-x-ds/global/TextField';
import TextArea from '../../../admin-x-ds/global/form/TextArea';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -1,9 +1,9 @@
import ImageUpload from '../../../admin-x-ds/global/ImageUpload';
import ImageUpload from '../../../admin-x-ds/global/form/ImageUpload';
import React, {useContext} from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextArea from '../../../admin-x-ds/global/TextArea';
import TextField from '../../../admin-x-ds/global/TextField';
import TextArea from '../../../admin-x-ds/global/form/TextArea';
import TextField from '../../../admin-x-ds/global/form/TextField';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {FileService, ServicesContext} from '../../providers/ServiceProvider';
import {ReactComponent as TwitterLogo} from '../../../admin-x-ds/assets/images/twitter-logo.svg';

View File

@ -1,17 +1,17 @@
import Button from '../../../admin-x-ds/global/Button';
import ConfirmationModal from '../../../admin-x-ds/global/ConfirmationModal';
import ConfirmationModal from '../../../admin-x-ds/global/modal/ConfirmationModal';
import Heading from '../../../admin-x-ds/global/Heading';
import Icon from '../../../admin-x-ds/global/Icon';
import ImageUpload from '../../../admin-x-ds/global/ImageUpload';
import ImageUpload from '../../../admin-x-ds/global/form/ImageUpload';
import Menu from '../../../admin-x-ds/global/Menu';
import Modal from '../../../admin-x-ds/global/Modal';
import Modal from '../../../admin-x-ds/global/modal/Modal';
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import Radio from '../../../admin-x-ds/global/Radio';
import Radio from '../../../admin-x-ds/global/form/Radio';
import React, {useContext, useEffect, useRef, useState} from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../admin-x-ds/global/TextField';
import Toggle from '../../../admin-x-ds/global/Toggle';
import TextField from '../../../admin-x-ds/global/form/TextField';
import Toggle from '../../../admin-x-ds/global/form/Toggle';
import useRoles from '../../../hooks/useRoles';
import useStaffUsers from '../../../hooks/useStaffUsers';
import validator from 'validator';

View File

@ -1,6 +1,6 @@
import MultiSelect, {MultiSelectOption} from '../../../admin-x-ds/global/MultiSelect';
import MultiSelect, {MultiSelectOption} from '../../../admin-x-ds/global/form/MultiSelect';
import React, {useContext, useEffect, useState} from 'react';
import Select from '../../../admin-x-ds/global/Select';
import Select from '../../../admin-x-ds/global/form/Select';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import useSettingGroup from '../../../hooks/useSettingGroup';

View File

@ -2,7 +2,7 @@ import Button from '../../../admin-x-ds/global/Button';
import React from 'react';
import SettingGroup from '../../../admin-x-ds/settings/SettingGroup';
import SettingGroupContent from '../../../admin-x-ds/settings/SettingGroupContent';
import Toggle from '../../../admin-x-ds/global/Toggle';
import Toggle from '../../../admin-x-ds/global/form/Toggle';
import useSettingGroup from '../../../hooks/useSettingGroup';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -1,5 +1,5 @@
import BrandSettings, {BrandSettingValues} from './designAndBranding/BrandSettings';
import ConfirmationModal from '../../../admin-x-ds/global/ConfirmationModal';
import ConfirmationModal from '../../../admin-x-ds/global/modal/ConfirmationModal';
import NiceModal, {useModal} from '@ebay/nice-modal-react';
import React, {useContext, useEffect, useState} from 'react';
import TabView, {Tab} from '../../../admin-x-ds/global/TabView';
@ -7,7 +7,7 @@ import ThemePreview from './designAndBranding/ThemePreview';
import ThemeSettings from './designAndBranding/ThemeSettings';
import useForm from '../../../hooks/useForm';
import {CustomThemeSetting, Post, Setting, SettingValue, SiteData} from '../../../types/api';
import {PreviewModalContent} from '../../../admin-x-ds/global/PreviewModal';
import {PreviewModalContent} from '../../../admin-x-ds/global/modal/PreviewModal';
import {ServicesContext} from '../../providers/ServiceProvider';
import {SettingsContext} from '../../providers/SettingsProvider';
import {getSettingValues} from '../../../utils/helpers';

View File

@ -1,8 +1,8 @@
import AdvancedThemeSettings from './theme/AdvancedThemeSettings';
import Button from '../../../admin-x-ds/global/Button';
import ButtonGroup from '../../../admin-x-ds/global/ButtonGroup';
import FileUpload from '../../../admin-x-ds/global/FileUpload';
import Modal from '../../../admin-x-ds/global/Modal';
import FileUpload from '../../../admin-x-ds/global/form/FileUpload';
import Modal from '../../../admin-x-ds/global/modal/Modal';
import NewThemePreview from './theme/ThemePreview';
import NiceModal, {NiceModalHandler, useModal} from '@ebay/nice-modal-react';
import OfficialThemes from './theme/OfficialThemes';
@ -45,7 +45,7 @@ const ThemeToolbar: React.FC<ThemeToolbarProps> = ({
return (
<div className='sticky top-0 flex justify-between gap-3 bg-grey-50 p-5 px-7'>
<div className='flex items-center gap-2'>
<div className='flex w-[33%] items-center gap-2'>
<button
className={`text-sm`}
type="button"
@ -58,7 +58,7 @@ const ThemeToolbar: React.FC<ThemeToolbarProps> = ({
&rarr;
<span className='text-sm font-bold'>{selectedTheme?.name}</span>
</div>
<div className='flex justify-end gap-8'>
<div className='flex w-[33%] justify-end gap-8'>
<ButtonGroup
buttons={[
{icon: 'laptop', link: true, size: 'sm'},

View File

@ -1,9 +1,9 @@
import Heading from '../../../../admin-x-ds/global/Heading';
import Hint from '../../../../admin-x-ds/global/Hint';
import ImageUpload from '../../../../admin-x-ds/global/ImageUpload';
import ImageUpload from '../../../../admin-x-ds/global/form/ImageUpload';
import React, {useContext} from 'react';
import SettingGroupContent from '../../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../../admin-x-ds/global/TextField';
import TextField from '../../../../admin-x-ds/global/form/TextField';
import {ServicesContext} from '../../../providers/ServiceProvider';
import {SettingValue} from '../../../../types/api';

View File

@ -1,10 +1,10 @@
import Heading from '../../../../admin-x-ds/global/Heading';
import ImageUpload from '../../../../admin-x-ds/global/ImageUpload';
import ImageUpload from '../../../../admin-x-ds/global/form/ImageUpload';
import React, {useContext} from 'react';
import Select from '../../../../admin-x-ds/global/Select';
import Select from '../../../../admin-x-ds/global/form/Select';
import SettingGroupContent from '../../../../admin-x-ds/settings/SettingGroupContent';
import TextField from '../../../../admin-x-ds/global/TextField';
import Toggle from '../../../../admin-x-ds/global/Toggle';
import TextField from '../../../../admin-x-ds/global/form/TextField';
import Toggle from '../../../../admin-x-ds/global/form/Toggle';
import {CustomThemeSetting} from '../../../../types/api';
import {ServicesContext} from '../../../providers/ServiceProvider';
import {humanizeSettingKey} from '../../../../utils/helpers';