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

Add an about section in the editor #667

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
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
88 changes: 88 additions & 0 deletions src/editor-sidebar/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import {
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalVStack as VStack,
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalText as Text,
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalDivider as Divider,
PanelBody,
ExternalLink,
} from '@wordpress/components';

/**
* Internal dependencies
*/
import ScreenHeader from './screen-header';

function AboutPlugin() {
return (
<PanelBody>
<ScreenHeader
title={ __( 'About the plugin', 'create-block-theme' ) }
/>
<VStack>
<Text>
{ __(
'Create Block Theme is a tool to help you make Block Themes using the WordPress Editor. It does this by adding tools to the Editor to help you create and manage your theme.',
'create-block-theme'
) }
</Text>

<Text>
{ __(
"Themes created with Create Block Theme don't require Create Block Theme to be installed on the site where the theme is used.",
'create-block-theme'
) }
</Text>

<Divider />

<Text weight="bold">
{ __( 'Help', 'create-block-theme' ) }
</Text>

<Text>
<>
{ __( 'Have a question?', 'create-block-theme' ) }
<br />
<ExternalLink href="https://wordpress.org/support/plugin/create-block-theme/">
{ __( 'Ask in the forums.', 'create-block-theme' ) }
</ExternalLink>
</>
</Text>

<Text>
<>
{ __( 'Found a bug?', 'create-block-theme' ) }
<br />
<ExternalLink href="https://github.com/WordPress/create-block-theme/issues">
{ __(
'Report it on GitHub.',
'create-block-theme'
) }
</ExternalLink>
</>
</Text>

<Text>
<>
{ __( 'Want to contribute?', 'create-block-theme' ) }
<br />
<ExternalLink href="https://github.com/WordPress/create-block-theme">
{ __(
'Check out the project on GitHub.',
'create-block-theme'
) }
</ExternalLink>
</>
</Text>
</VStack>
</PanelBody>
);
}

export default AboutPlugin;
34 changes: 31 additions & 3 deletions src/plugin-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
__experimentalHStack as HStack,
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalText as Text,
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
__experimentalDivider as Divider,
Button,
Icon,
FlexItem,
Expand All @@ -36,6 +38,7 @@ import {
chevronRight,
addCard,
blockMeta,
help,
} from '@wordpress/icons';

/**
Expand All @@ -50,6 +53,7 @@ import ScreenHeader from './editor-sidebar/screen-header';
import { downloadExportedTheme } from './resolvers';
import downloadFile from './utils/download-file';
import './plugin-styles.scss';
import AboutPlugin from './editor-sidebar/about';

const CreateBlockThemePlugin = () => {
const [ isEditorOpen, setIsEditorOpen ] = useState( false );
Expand Down Expand Up @@ -155,7 +159,7 @@ const CreateBlockThemePlugin = () => {
>
{ __( 'Export Zip', 'create-block-theme' ) }
</Button>
<hr></hr>
<Divider />
<NavigatorButton
path="/create/blank"
icon={ addCard }
Expand Down Expand Up @@ -183,6 +187,26 @@ const CreateBlockThemePlugin = () => {
<Icon icon={ chevronRight } />
</HStack>
</NavigatorButton>

<Divider />

<NavigatorButton
path="/about"
icon={ help }
className={
'create-block-theme__plugin-sidebar__about-button'
}
>
<Spacer />
<HStack>
<FlexItem>
{ __(
'Help',
'create-block-theme'
) }
</FlexItem>
</HStack>
</NavigatorButton>
</VStack>
</PanelBody>
</NavigatorScreen>
Expand All @@ -202,7 +226,7 @@ const CreateBlockThemePlugin = () => {
'create-block-theme'
) }
</Text>
<hr></hr>
<Divider />
<NavigatorButton
path="/clone/create"
icon={ copy }
Expand All @@ -227,7 +251,7 @@ const CreateBlockThemePlugin = () => {
'create-block-theme'
) }
</Text>
<hr></hr>
<Divider />
<NavigatorButton
path="/clone/create"
icon={ copy }
Expand Down Expand Up @@ -271,6 +295,10 @@ const CreateBlockThemePlugin = () => {
<NavigatorScreen path="/save">
<SaveThemePanel />
</NavigatorScreen>

<NavigatorScreen path="/about">
<AboutPlugin />
</NavigatorScreen>
</NavigatorProvider>
</PluginSidebar>

Expand Down
13 changes: 13 additions & 0 deletions src/plugin-styles.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "~@wordpress/base-styles/colors";

$plugin-prefix: "create-block-theme";
$modal-footer-height: 70px;

Expand All @@ -22,4 +24,15 @@ $modal-footer-height: 70px;
object-fit: cover;
}
}

&__plugin-sidebar {
&__about-button {
color: $gray-600;
margin-top: 3rem;
}

&__about-button svg {
fill: $gray-600;
}
}
}
Loading