Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: replace TabPanel with Tabs in the editor Global Styles color palette #57126

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { TabPanel } from '@wordpress/components';
import { privateApis as componentsPrivateApis } from '@wordpress/components';

/**
* Internal dependencies
*/
import ColorPalettePanel from './color-palette-panel';
import GradientPalettePanel from './gradients-palette-panel';
import ScreenHeader from './header';
import { unlock } from '../../lock-unlock';

const { Tabs } = unlock( componentsPrivateApis );

function ScreenColorPalette( { name } ) {
return (
Expand All @@ -20,31 +23,18 @@ function ScreenColorPalette( { name } ) {
'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'
) }
/>
<TabPanel
tabs={ [
{
name: 'solid',
title: 'Solid',
value: 'solid',
},
{
name: 'gradient',
title: 'Gradient',
value: 'gradient',
},
] }
>
{ ( tab ) => (
<>
{ tab.value === 'solid' && (
<ColorPalettePanel name={ name } />
) }
{ tab.value === 'gradient' && (
<GradientPalettePanel name={ name } />
) }
</>
) }
</TabPanel>
<Tabs>
<Tabs.TabList>
<Tabs.Tab tabId="solid">Solid</Tabs.Tab>
<Tabs.Tab tabId="gradient">Gradient</Tabs.Tab>
</Tabs.TabList>
<Tabs.TabPanel tabId="solid" focusable={ false }>
<ColorPalettePanel name={ name } />
</Tabs.TabPanel>
<Tabs.TabPanel tabId="gradient" focusable={ false }>
<GradientPalettePanel name={ name } />
</Tabs.TabPanel>
</Tabs>
</>
);
}
Expand Down
Loading