Theme: Use outline buttons for Cancel & Back actions (#33418)

* Buttons: Use new outline button for cancel & back buttons

* More buttons

* More tweaks

* Updated row snapshot
This commit is contained in:
Torkel Ödegaard 2021-04-27 15:36:48 +02:00 committed by GitHub
parent e8faec5c19
commit eef4e18b62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 59 additions and 55 deletions

View File

@ -69,7 +69,7 @@ export const ConfirmModal = ({
) : null} ) : null}
</div> </div>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss}> <Button variant="secondary" onClick={onDismiss} fill="outline">
{dismissText} {dismissText}
</Button> </Button>
<Button <Button

View File

@ -34,10 +34,10 @@ export const RowOptionsForm: FC<Props> = ({ repeat, title, onUpdate, onCancel })
</Field> </Field>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button type="submit">Update</Button> <Button variant="secondary" onClick={onCancel} fill="outline">
<Button variant="secondary" onClick={onCancel}>
Cancel Cancel
</Button> </Button>
<Button type="submit">Update</Button>
</Modal.ButtonRow> </Modal.ButtonRow>
</> </>
)} )}

View File

@ -90,6 +90,9 @@ const ConfirmPluginDashboardSaveModal: React.FC<SaveDashboardModalProps> = ({ on
</small> </small>
</div> </div>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel
</Button>
<SaveDashboardAsButton dashboard={dashboard} onSaveSuccess={onDismiss} /> <SaveDashboardAsButton dashboard={dashboard} onSaveSuccess={onDismiss} />
<Button <Button
variant="destructive" variant="destructive"
@ -100,9 +103,6 @@ const ConfirmPluginDashboardSaveModal: React.FC<SaveDashboardModalProps> = ({ on
> >
Overwrite Overwrite
</Button> </Button>
<Button variant="secondary" onClick={onDismiss}>
Cancel
</Button>
</Modal.ButtonRow> </Modal.ButtonRow>
</div> </div>
</Modal> </Modal>

View File

@ -29,7 +29,7 @@ export const UnsavedChangesModal: React.FC<UnsavedChangesModalProps> = ({
> >
<h5>Do you want to save your changes?</h5> <h5>Do you want to save your changes?</h5>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss}> <Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel Cancel
</Button> </Button>
<Button <Button

View File

@ -115,7 +115,7 @@ export const SaveDashboardAsForm: React.FC<SaveDashboardFormProps & { isNew?: bo
<Switch name="copyTags" ref={register} /> <Switch name="copyTags" ref={register} />
</Field> </Field>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onCancel}> <Button variant="secondary" onClick={onCancel} fill="outline">
Cancel Cancel
</Button> </Button>
<Button type="submit" aria-label="Save dashboard button"> <Button type="submit" aria-label="Save dashboard button">

View File

@ -59,7 +59,7 @@ export const SaveDashboardForm: React.FC<SaveDashboardFormProps> = ({ dashboard,
</div> </div>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onCancel}> <Button variant="secondary" onClick={onCancel} fill="outline">
Cancel Cancel
</Button> </Button>
<Button type="submit" aria-label={selectors.pages.SaveDashboardModal.save}> <Button type="submit" aria-label={selectors.pages.SaveDashboardModal.save}>

View File

@ -58,7 +58,7 @@ export const SaveProvisionedDashboardForm: React.FC<SaveDashboardFormProps> = ({
className={styles.json} className={styles.json}
/> />
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onCancel}> <Button variant="secondary" onClick={onCancel} fill="outline">
Cancel Cancel
</Button> </Button>
<CopyToClipboard text={() => dashboardJSON} elType={Button} onSuccess={onCopyToClipboardSuccess}> <CopyToClipboard text={() => dashboardJSON} elType={Button} onSuccess={onCopyToClipboardSuccess}>

View File

@ -96,7 +96,7 @@ export class ShareExport extends PureComponent<Props, State> {
<Switch value={shareExternally} onChange={this.onShareExternallyChange} /> <Switch value={shareExternally} onChange={this.onShareExternallyChange} />
</Field> </Field>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss}> <Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel Cancel
</Button> </Button>
<Button variant="secondary" onClick={this.onViewJson}> <Button variant="secondary" onClick={this.onViewJson}>

View File

@ -234,7 +234,7 @@ export class ShareSnapshot extends PureComponent<Props, State> {
</Field> </Field>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss}> <Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel Cancel
</Button> </Button>
{externalEnabled && ( {externalEnabled && (

View File

@ -96,7 +96,9 @@ class NewDataSourcePage extends PureComponent<Props> {
<div className="page-action-bar"> <div className="page-action-bar">
<FilterInput value={searchQuery} onChange={this.onSearchQueryChange} placeholder="Filter by name or type" /> <FilterInput value={searchQuery} onChange={this.onSearchQueryChange} placeholder="Filter by name or type" />
<div className="page-action-bar__spacer" /> <div className="page-action-bar__spacer" />
<LinkButton href="datasources">Cancel</LinkButton> <LinkButton href="datasources" fill="outline" variant="secondary" icon="arrow-left">
Cancel
</LinkButton>
</div> </div>
{!searchQuery && ( {!searchQuery && (
<PluginsErrorsInfo> <PluginsErrorsInfo>

View File

@ -14,6 +14,18 @@ export interface Props {
const ButtonRow: FC<Props> = ({ isReadOnly, onDelete, onSubmit, onTest }) => { const ButtonRow: FC<Props> = ({ isReadOnly, onDelete, onSubmit, onTest }) => {
return ( return (
<div className="gf-form-button-row"> <div className="gf-form-button-row">
<LinkButton variant="secondary" fill="outline" href={`${config.appSubUrl}/datasources`}>
Back
</LinkButton>
<Button
type="button"
variant="destructive"
disabled={isReadOnly}
onClick={onDelete}
aria-label={selectors.pages.DataSource.delete}
>
Delete
</Button>
{!isReadOnly && ( {!isReadOnly && (
<Button <Button
type="submit" type="submit"
@ -30,18 +42,6 @@ const ButtonRow: FC<Props> = ({ isReadOnly, onDelete, onSubmit, onTest }) => {
Test Test
</Button> </Button>
)} )}
<Button
type="button"
variant="destructive"
disabled={isReadOnly}
onClick={onDelete}
aria-label={selectors.pages.DataSource.delete}
>
Delete
</Button>
<LinkButton fill="text" href={`${config.appSubUrl}/datasources`}>
Back
</LinkButton>
</div> </div>
); );
}; };

View File

@ -174,7 +174,7 @@ export class DataSourceSettingsPage extends PureComponent<Props> {
Delete Delete
</Button> </Button>
)} )}
<LinkButton variant="link" href="datasources"> <LinkButton variant="secondary" href="datasources" fill="outline">
Back Back
</LinkButton> </LinkButton>
</div> </div>

View File

@ -4,13 +4,13 @@ exports[`Render should render component 1`] = `
<div <div
className="gf-form-button-row" className="gf-form-button-row"
> >
<Button <LinkButton
onClick={[MockFunction]} fill="outline"
type="submit" href="/datasources"
variant="primary" variant="secondary"
> >
Test Back
</Button> </LinkButton>
<Button <Button
aria-label="Data source settings page Delete button" aria-label="Data source settings page Delete button"
disabled={true} disabled={true}
@ -20,12 +20,13 @@ exports[`Render should render component 1`] = `
> >
Delete Delete
</Button> </Button>
<LinkButton <Button
fill="text" onClick={[MockFunction]}
href="/datasources" type="submit"
variant="primary"
> >
Back Test
</LinkButton> </Button>
</div> </div>
`; `;
@ -33,15 +34,13 @@ exports[`Render should render with buttons enabled 1`] = `
<div <div
className="gf-form-button-row" className="gf-form-button-row"
> >
<Button <LinkButton
aria-label="Data source settings page Save and Test button" fill="outline"
disabled={false} href="/datasources"
onClick={[Function]} variant="secondary"
type="submit"
variant="primary"
> >
Save & test Back
</Button> </LinkButton>
<Button <Button
aria-label="Data source settings page Delete button" aria-label="Data source settings page Delete button"
disabled={false} disabled={false}
@ -51,11 +50,14 @@ exports[`Render should render with buttons enabled 1`] = `
> >
Delete Delete
</Button> </Button>
<LinkButton <Button
fill="text" aria-label="Data source settings page Save and Test button"
href="/datasources" disabled={false}
onClick={[Function]}
type="submit"
variant="primary"
> >
Back Save & test
</LinkButton> </Button>
</div> </div>
`; `;

View File

@ -24,6 +24,9 @@ export const AddLibraryPanelContents = ({ panel, initialFolderId, onDismiss }: A
</Field> </Field>
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel
</Button>
<Button <Button
onClick={() => { onClick={() => {
panel.title = panelTitle; panel.title = panelTitle;
@ -32,9 +35,6 @@ export const AddLibraryPanelContents = ({ panel, initialFolderId, onDismiss }: A
> >
Add panel to the panel library Add panel to the panel library
</Button> </Button>
<Button variant="secondary" onClick={onDismiss}>
Cancel
</Button>
</Modal.ButtonRow> </Modal.ButtonRow>
</> </>
); );

View File

@ -36,7 +36,7 @@ export const DeleteLibraryPanelModal: FC<Props> = ({ libraryPanel, onDismiss, on
{!connected ? <Confirm /> : null} {!connected ? <Confirm /> : null}
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss}> <Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel Cancel
</Button> </Button>
<Button variant="destructive" onClick={onConfirm} disabled={connected}> <Button variant="destructive" onClick={onConfirm} disabled={connected}>

View File

@ -99,7 +99,7 @@ export const SaveLibraryPanelModal: React.FC<Props> = ({
</table> </table>
)} )}
<Modal.ButtonRow> <Modal.ButtonRow>
<Button variant="secondary" onClick={onDismiss}> <Button variant="secondary" onClick={onDismiss} fill="outline">
Cancel Cancel
</Button> </Button>
<Button variant="destructive" onClick={discardAndClose}> <Button variant="destructive" onClick={discardAndClose}>