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

Try/publish in site editor #51408

Merged
merged 41 commits into from
Jun 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7213d66
add required inputs
SaxonF Jun 9, 2023
c938235
schedule date
SaxonF Jun 12, 2023
e46f5ff
add password and fix a few things
SaxonF Jun 12, 2023
511bacc
re-add status modal
SaxonF Jun 13, 2023
73f89b4
update change status modal
SaxonF Jun 13, 2023
d5013da
revert in sidebar status change
SaxonF Jun 13, 2023
fc692d0
refine a few status details
SaxonF Jun 13, 2023
0d25392
fix merge issues
SaxonF Jun 14, 2023
42145f0
fix status label
SaxonF Jun 14, 2023
736fac9
use null for status date
SaxonF Jun 14, 2023
46f7ad5
handle empty date
SaxonF Jun 15, 2023
2df2fc9
change to add fields instead of modal
SaxonF Jun 15, 2023
710e36c
default publish not draft
SaxonF Jun 15, 2023
01b0a07
remove style import
SaxonF Jun 15, 2023
7dec51c
add required inputs
SaxonF Jun 9, 2023
368cdef
schedule date
SaxonF Jun 12, 2023
12554e3
add password and fix a few things
SaxonF Jun 12, 2023
01f58b3
re-add status modal
SaxonF Jun 13, 2023
94031eb
update change status modal
SaxonF Jun 13, 2023
6582538
revert in sidebar status change
SaxonF Jun 13, 2023
2c05b56
refine a few status details
SaxonF Jun 13, 2023
41e15e9
fix merge issues
SaxonF Jun 14, 2023
fc295e0
fix status label
SaxonF Jun 14, 2023
96ba33f
use null for status date
SaxonF Jun 14, 2023
1fa27ab
handle empty date
SaxonF Jun 15, 2023
14e2254
change to add fields instead of modal
SaxonF Jun 15, 2023
053c3cf
default publish not draft
SaxonF Jun 15, 2023
a3949c2
remove style import
SaxonF Jun 15, 2023
2f088b9
Merge branch 'try/publish-in-site-editor' of https://github.com/WordP…
SaxonF Jun 16, 2023
cfbb607
Merge branch 'trunk' into try/publish-in-site-editor
SaxonF Jun 16, 2023
3e51dff
remove css
SaxonF Jun 16, 2023
d07a143
only autofocus password field if empty
SaxonF Jun 19, 2023
ff96c4c
aria label on status popover
SaxonF Jun 20, 2023
9e28a27
remove end line
SaxonF Jun 20, 2023
2a13222
Merge branch 'trunk' into try/publish-in-site-editor
SaxonF Jun 20, 2023
ca88703
create radio with help component
SaxonF Jun 20, 2023
8dbad15
Merge branch 'trunk' into try/publish-in-site-editor
SaxonF Jun 20, 2023
d0b09cc
adjust to use radiocontrol and hide password
SaxonF Jun 20, 2023
d4d7fde
radio label alignment
SaxonF Jun 20, 2023
7cf6f3c
add form wrapper
SaxonF Jun 20, 2023
6c55aa1
aria label
SaxonF Jun 20, 2023
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
Prev Previous commit
Next Next commit
create radio with help component
  • Loading branch information
SaxonF committed Jun 20, 2023
commit ca88703e3bae80d61c907422a10837f06b1cba45
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useDispatch } from '@wordpress/data';
import { useState, useMemo } from '@wordpress/element';
import { useState, useMemo, useId } from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';
import { store as noticesStore } from '@wordpress/notices';
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
Expand Down Expand Up @@ -158,39 +158,13 @@ export default function PageStatus( {
className={ 'components-radio-control' }
>
<VStack spacing={ 3 }>
{ STATUS_OPTIONS.map( ( option, index ) => (
<div
{ STATUS_OPTIONS.map( ( option ) => (
<RadioWithHelp
key={ option.value }
className="components-radio-control__option with-hint"
>
<input
id={ `edit-site-change-status__status-${ index }` }
className="components-radio-control__input"
type="radio"
name={ `edit-site-change-status__status` }
value={ option.value }
onChange={ ( e ) =>
handleStatus(
e.target.value
)
}
checked={
option.value === status
}
/>
<VStack spacing={ 1 }>
<label
htmlFor={ `edit-site-change-status__status-${ index }` }
>
{ option.label }
</label>
{ option.hint && (
<Text variant="muted">
{ option.hint }
</Text>
) }
</VStack>
</div>
option={ option }
checked={ option.value === status }
onChange={ handleStatus }
/>
) ) }
</VStack>
</BaseControl>
Expand Down Expand Up @@ -228,3 +202,30 @@ export default function PageStatus( {
</HStack>
);
}

const RadioWithHelp = ( { option, onChange, checked } ) => {
const id = useId();

return (
<div
key={ option.value }
className="components-radio-control__option with-hint"
>
<input
id={ `${ id }-${ option.value }` }
className="components-radio-control__input"
type="radio"
name={ `edit-site-change-status__status` }
value={ option.value }
onChange={ ( e ) => onChange( e.target.value ) }
checked={ checked }
/>
<VStack spacing={ 1 }>
<label htmlFor={ `${ id }-${ option.value }` }>
{ option.label }
</label>
{ option.hint && <Text variant="muted">{ option.hint }</Text> }
</VStack>
</div>
);
};