mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Improved Add/Edit Recommendations flow design (#17923)
refs https://github.com/TryGhost/Product/issues/3773 - Improved recommendation preview in the modal - Added separate Back button - Fixed Table spacing issue
This commit is contained in:
parent
c6cb35074a
commit
2f5a4d801b
3 changed files with 28 additions and 9 deletions
|
@ -34,7 +34,7 @@ const Table: React.FC<TableProps> = ({children, borderTop, hint, hintSeparator,
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{hint &&
|
{hint &&
|
||||||
<div>
|
<div className="-mt-px">
|
||||||
{hintSeparator && <Separator />}
|
{hintSeparator && <Separator />}
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<Hint>{hint}</Hint>
|
<Hint>{hint}</Hint>
|
||||||
|
|
|
@ -42,14 +42,24 @@ const AddRecommendationModalConfirm: React.FC<AddRecommendationModalProps> = ({r
|
||||||
okLabel = 'Added';
|
okLabel = 'Added';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let leftButtonProps = {
|
||||||
|
label: 'Back',
|
||||||
|
icon: 'arrow-left',
|
||||||
|
size: 'sm' as const,
|
||||||
|
onClick: () => {
|
||||||
|
alert('Left button click');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return <Modal
|
return <Modal
|
||||||
afterClose={() => {
|
afterClose={() => {
|
||||||
// Closed without saving: reset route
|
// Closed without saving: reset route
|
||||||
updateRoute('recommendations');
|
updateRoute('recommendations');
|
||||||
}}
|
}}
|
||||||
animate={animate ?? true}
|
animate={animate ?? true}
|
||||||
cancelLabel={'Back'}
|
cancelLabel={'Cancel'}
|
||||||
dirty={true}
|
dirty={true}
|
||||||
|
leftButtonProps={leftButtonProps}
|
||||||
okColor='black'
|
okColor='black'
|
||||||
okLabel={okLabel}
|
okLabel={okLabel}
|
||||||
size='sm'
|
size='sm'
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import Avatar from '../../../../admin-x-ds/global/Avatar';
|
import Avatar from '../../../../admin-x-ds/global/Avatar';
|
||||||
import Form from '../../../../admin-x-ds/global/form/Form';
|
import Form from '../../../../admin-x-ds/global/form/Form';
|
||||||
|
import Heading from '../../../../admin-x-ds/global/Heading';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import TextArea from '../../../../admin-x-ds/global/form/TextArea';
|
import TextArea from '../../../../admin-x-ds/global/form/TextArea';
|
||||||
|
import TextField from '../../../../admin-x-ds/global/form/TextField';
|
||||||
import {EditOrAddRecommendation, Recommendation} from '../../../../api/recommendations';
|
import {EditOrAddRecommendation, Recommendation} from '../../../../api/recommendations';
|
||||||
|
|
||||||
interface Props<T extends EditOrAddRecommendation> {
|
interface Props<T extends EditOrAddRecommendation> {
|
||||||
|
@ -14,17 +16,24 @@ const RecommendationReasonForm: React.FC<Props<EditOrAddRecommendation | Recomme
|
||||||
marginBottom={false}
|
marginBottom={false}
|
||||||
marginTop
|
marginTop
|
||||||
>
|
>
|
||||||
<div className='mb-4 flex items-center gap-3 rounded-sm border border-grey-300 p-3'>
|
<div>
|
||||||
{(formState.favicon || formState.featured_image) && <Avatar image={formState.favicon ?? formState.featured_image!} labelColor='white' />}
|
<Heading className='mb-2 block text-2xs font-semibold uppercase tracking-wider text-grey-700'>Preview</Heading>
|
||||||
<div className={`flex grow flex-col`}>
|
<a className='flex items-center gap-3 rounded-sm border border-grey-300 p-3' href={formState.url} rel="noopener noreferrer" target="_blank">
|
||||||
<span className='mb-0.5 font-medium'>{formState.title}</span>
|
{(formState.favicon || formState.featured_image) && <Avatar image={formState.favicon ?? formState.featured_image!} labelColor='white' />}
|
||||||
<span className='text-xs leading-snug text-grey-700'>{formState.url}</span>
|
<div className={`flex grow flex-col`}>
|
||||||
</div>
|
<span className='word-wrap mb-0.5 font-medium'>{formState.title}</span>
|
||||||
|
<span className='word-wrap text-xs leading-snug text-grey-700'>{formState.url}</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<TextField
|
||||||
|
title="Title"
|
||||||
|
value={formState.title ?? ''}
|
||||||
|
/>
|
||||||
<TextArea
|
<TextArea
|
||||||
clearBg={true}
|
clearBg={true}
|
||||||
rows={3}
|
rows={3}
|
||||||
title="Reason for recommending"
|
title="Reason for recommending (optional)"
|
||||||
value={formState.reason ?? ''}
|
value={formState.reason ?? ''}
|
||||||
onChange={e => updateForm(state => ({...state, reason: e.target.value}))}
|
onChange={e => updateForm(state => ({...state, reason: e.target.value}))}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue