-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e312501
commit dae6a60
Showing
4 changed files
with
70 additions
and
9 deletions.
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
packages/@sanity/field/src/diff/changes/RevertChangesButton.css
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,48 @@ | ||
@import 'part:@sanity/base/theme/variables-style'; | ||
|
||
.root { | ||
-webkit-font-smoothing: inherit; | ||
appearance: none; | ||
margin: 0; | ||
padding: var(--extra-small-padding); | ||
font: inherit; | ||
color: inherit; | ||
background: none; | ||
border: 0; | ||
border-radius: var(--border-radius-large); | ||
display: flex; | ||
align-items: center; | ||
color: var(--text-muted); | ||
outline: none; | ||
|
||
@media (hover: hover) { | ||
@nest &:hover { | ||
color: var(--state-danger-color); | ||
} | ||
} | ||
|
||
@nest &:focus-visible { | ||
box-shadow: inset 0 0 0 2px var(--component-bg), inset 0 0 0 4px var(--focus-color); | ||
} | ||
} | ||
|
||
.iconContainer { | ||
display: block; | ||
|
||
@nest & > svg { | ||
display: block; | ||
font-size: 19px; | ||
} | ||
} | ||
|
||
.text { | ||
display: block; | ||
font-size: var(--font-size-small); | ||
line-height: var(--line-height-small); | ||
margin: -2px 0 -1px; | ||
padding-right: 3px; | ||
|
||
@nest .iconContainer + & { | ||
margin-left: var(--extra-small-padding); | ||
} | ||
} |
17 changes: 12 additions & 5 deletions
17
packages/@sanity/field/src/diff/changes/RevertChangesButton.tsx
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 |
---|---|---|
@@ -1,13 +1,20 @@ | ||
import classNames from 'classnames' | ||
import React from 'react' | ||
import Button, {ButtonProps} from 'part:@sanity/components/buttons/default' | ||
import UndoIcon from 'part:@sanity/base/undo-icon' | ||
|
||
import styles from './RevertChangesButton.css' | ||
|
||
export function RevertChangesButton( | ||
props: Omit<ButtonProps, 'icon' | 'kind' | 'padding' | 'size'> | ||
props: Omit<React.HTMLProps<HTMLButtonElement>, 'type'> | ||
): React.ReactElement { | ||
const {className, ...restProps} = props | ||
|
||
return ( | ||
<Button {...props} icon={UndoIcon} kind="simple" padding="small" size="small"> | ||
Revert changes | ||
</Button> | ||
<button {...restProps} className={classNames(styles.root, className)} type="button"> | ||
<span className={styles.iconContainer}> | ||
<UndoIcon /> | ||
</span> | ||
<span className={styles.text}>Revert changes</span> | ||
</button> | ||
) | ||
} |