-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- refactoring page details so that the styles and components can be used in templates - getting home template details in order
- Loading branch information
Showing
13 changed files
with
233 additions
and
51 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
packages/edit-site/src/components/sidebar-navigation-screen-details-panel/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
__experimentalVStack as VStack, | ||
__experimentalHeading as Heading, | ||
} from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import SidebarNavigationScreenDetailsPanelLabel from './sidebar-navigation-screen-details-panel-label'; | ||
import SidebarNavigationScreenDetailsPanelRow from './sidebar-navigation-screen-details-panel-row'; | ||
import SidebarNavigationScreenDetailsPanelValue from './sidebar-navigation-screen-details-panel-value'; | ||
|
||
function SidebarNavigationScreenDetailsPanel( { title, children } ) { | ||
return ( | ||
<VStack | ||
className="edit-site-sidebar-navigation-details-screen-panel" | ||
spacing={ 5 } | ||
> | ||
<Heading | ||
className="edit-site-sidebar-navigation-details-screen-panel__heading" | ||
level={ 3 } | ||
> | ||
{ title } | ||
</Heading> | ||
{ children } | ||
</VStack> | ||
); | ||
} | ||
|
||
export { | ||
SidebarNavigationScreenDetailsPanel, | ||
SidebarNavigationScreenDetailsPanelRow, | ||
SidebarNavigationScreenDetailsPanelLabel, | ||
SidebarNavigationScreenDetailsPanelValue, | ||
}; |
14 changes: 14 additions & 0 deletions
14
.../sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalText as Text } from '@wordpress/components'; | ||
|
||
export default function SidebarNavigationScreenDetailsPanelLabel( { | ||
children, | ||
} ) { | ||
return ( | ||
<Text className="edit-site-sidebar-navigation-details-screen-panel__label"> | ||
{ children } | ||
</Text> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
...ts/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalHStack as HStack } from '@wordpress/components'; | ||
|
||
export default function SidebarNavigationScreenDetailsPanelRow( { | ||
label, | ||
children, | ||
} ) { | ||
return ( | ||
<HStack | ||
key={ label } | ||
spacing={ 5 } | ||
alignment="left" | ||
className="edit-site-sidebar-navigation-details-screen-panel__row" | ||
> | ||
{ children } | ||
</HStack> | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
.../sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __experimentalText as Text } from '@wordpress/components'; | ||
|
||
export default function SidebarNavigationScreenDetailsPanelValue( { | ||
children, | ||
} ) { | ||
return ( | ||
<Text className="edit-site-sidebar-navigation-details-screen-panel__value"> | ||
{ children } | ||
</Text> | ||
); | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/edit-site/src/components/sidebar-navigation-screen-details-panel/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.edit-site-sidebar-navigation-details-screen-panel { | ||
margin-bottom: $grid-unit-30; | ||
|
||
.edit-site-sidebar-navigation-details-screen-panel__heading { | ||
color: $gray-400; | ||
text-transform: uppercase; | ||
font-weight: 500; | ||
font-size: 11px; | ||
padding: $grid-unit-10 0; | ||
padding-bottom: 0; | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.edit-site-sidebar-navigation-details-screen-panel__label { | ||
color: $gray-600; | ||
width: 100px; | ||
} | ||
|
||
.edit-site-sidebar-navigation-details-screen-panel__value.edit-site-sidebar-navigation-details-screen-panel__value { | ||
color: $gray-200; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...ages/edit-site/src/components/sidebar-navigation-screen-template/home-template-details.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { useSelect } from '@wordpress/data'; | ||
import { store as coreStore } from '@wordpress/core-data'; | ||
import { CheckboxControl } from '@wordpress/components'; | ||
import { store as blockEditorStore } from '@wordpress/block-editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { | ||
SidebarNavigationScreenDetailsPanel, | ||
SidebarNavigationScreenDetailsPanelRow, | ||
SidebarNavigationScreenDetailsPanelLabel, | ||
SidebarNavigationScreenDetailsPanelValue, | ||
} from '../sidebar-navigation-screen-details-panel'; | ||
|
||
export default function HomeTemplateDetails() { | ||
const { commentOrder, isHomePageBlog, postsPerPage, siteTitle } = useSelect( | ||
( select ) => { | ||
const { getEntityRecord } = select( coreStore ); | ||
const siteSettings = getEntityRecord( 'root', 'site' ); | ||
const { getSettings } = select( blockEditorStore ); | ||
|
||
return { | ||
isHomePageBlog: | ||
siteSettings?.page_for_posts === | ||
siteSettings?.page_on_front, | ||
siteTitle: siteSettings?.title, | ||
postsPerPage: siteSettings?.posts_per_page, | ||
commentOrder: | ||
getSettings()?.__experimentalDiscussionSettings | ||
?.commentOrder, | ||
}; | ||
}, | ||
[] | ||
); | ||
|
||
const noop = () => {}; | ||
|
||
return ( | ||
<> | ||
<SidebarNavigationScreenDetailsPanel title={ __( 'Settings' ) }> | ||
{ isHomePageBlog && ( | ||
<SidebarNavigationScreenDetailsPanelRow> | ||
<SidebarNavigationScreenDetailsPanelLabel> | ||
{ __( 'Posts per page' ) } | ||
</SidebarNavigationScreenDetailsPanelLabel> | ||
<SidebarNavigationScreenDetailsPanelValue> | ||
{ postsPerPage } | ||
</SidebarNavigationScreenDetailsPanelValue> | ||
</SidebarNavigationScreenDetailsPanelRow> | ||
) } | ||
<SidebarNavigationScreenDetailsPanelRow> | ||
<SidebarNavigationScreenDetailsPanelLabel> | ||
{ __( 'Blog title' ) } | ||
</SidebarNavigationScreenDetailsPanelLabel> | ||
<SidebarNavigationScreenDetailsPanelValue> | ||
{ siteTitle } | ||
</SidebarNavigationScreenDetailsPanelValue> | ||
</SidebarNavigationScreenDetailsPanelRow> | ||
</SidebarNavigationScreenDetailsPanel> | ||
|
||
<SidebarNavigationScreenDetailsPanel title={ __( 'Discussion' ) }> | ||
<SidebarNavigationScreenDetailsPanelRow> | ||
<CheckboxControl | ||
label="Allow comments on new posts" | ||
help="Individual posts may override these settings. Changes here will only be applied to new posts." | ||
checked={ true } | ||
onChange={ noop } | ||
/> | ||
</SidebarNavigationScreenDetailsPanelRow> | ||
<SidebarNavigationScreenDetailsPanelRow> | ||
<CheckboxControl | ||
label="Allow guest comments" | ||
help="Users do not have to be registered and logged in to comment." | ||
checked={ true } | ||
onChange={ noop } | ||
/> | ||
</SidebarNavigationScreenDetailsPanelRow> | ||
<SidebarNavigationScreenDetailsPanelRow> | ||
<SidebarNavigationScreenDetailsPanelLabel> | ||
{ __( 'Comment order' ) } | ||
</SidebarNavigationScreenDetailsPanelLabel> | ||
<SidebarNavigationScreenDetailsPanelValue> | ||
{ commentOrder } | ||
</SidebarNavigationScreenDetailsPanelValue> | ||
</SidebarNavigationScreenDetailsPanelRow> | ||
</SidebarNavigationScreenDetailsPanel> | ||
<SidebarNavigationScreenDetailsPanel title={ __( 'Areas' ) }> | ||
Test | ||
</SidebarNavigationScreenDetailsPanel> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
packages/edit-site/src/components/sidebar-navigation-subtitle/index.js
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
packages/edit-site/src/components/sidebar-navigation-subtitle/style.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters