about summary refs log tree commit diff
path: root/src/components/Prompt.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-05 14:57:53 +0100
committerGitHub <noreply@github.com>2024-04-05 14:57:53 +0100
commit49266c355ea781cbd7a0b373e64143da7740c91e (patch)
tree5f0a39882c30d2b8a8c5d8f952923c4a6fc3c607 /src/components/Prompt.tsx
parent9b087b721dee0a6a33bb85ac5098989ab965d658 (diff)
downloadvoidsky-49266c355ea781cbd7a0b373e64143da7740c91e.tar.zst
Remove special cases for some buttons with text (#3412)
* Toggle.Button -> Toggle.ButtonWithText

* Simplify Prompt.Cancel/Action

* Move lines down for better diff

* Remove ButtonWithText

* Simplify types
Diffstat (limited to 'src/components/Prompt.tsx')
-rw-r--r--src/components/Prompt.tsx20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx
index 000d2a3cd..3344b051b 100644
--- a/src/components/Prompt.tsx
+++ b/src/components/Prompt.tsx
@@ -91,15 +91,13 @@ export function Actions({children}: React.PropsWithChildren<{}>) {
 }
 
 export function Cancel({
-  children,
   cta,
-}: React.PropsWithChildren<{
+}: {
   /**
-   * Optional i18n string, used in lieu of `children` for simple buttons. If
-   * undefined (and `children` is undefined), it will default to "Cancel".
+   * Optional i18n string. If undefined, it will default to "Cancel".
    */
   cta?: string
-}>) {
+}) {
   const {_} = useLingui()
   const {gtMobile} = useBreakpoints()
   const {close} = Dialog.useDialogContext()
@@ -114,27 +112,25 @@ export function Cancel({
       size={gtMobile ? 'small' : 'medium'}
       label={cta || _(msg`Cancel`)}
       onPress={onPress}>
-      {children ? children : <ButtonText>{cta || _(msg`Cancel`)}</ButtonText>}
+      <ButtonText>{cta || _(msg`Cancel`)}</ButtonText>
     </Button>
   )
 }
 
 export function Action({
-  children,
   onPress,
   color = 'primary',
   cta,
   testID,
-}: React.PropsWithChildren<{
+}: {
   onPress: () => void
   color?: ButtonColor
   /**
-   * Optional i18n string, used in lieu of `children` for simple buttons. If
-   * undefined (and `children` is undefined), it will default to "Confirm".
+   * Optional i18n string. If undefined, it will default to "Confirm".
    */
   cta?: string
   testID?: string
-}>) {
+}) {
   const {_} = useLingui()
   const {gtMobile} = useBreakpoints()
   const {close} = Dialog.useDialogContext()
@@ -151,7 +147,7 @@ export function Action({
       label={cta || _(msg`Confirm`)}
       onPress={handleOnPress}
       testID={testID}>
-      {children ? children : <ButtonText>{cta || _(msg`Confirm`)}</ButtonText>}
+      <ButtonText>{cta || _(msg`Confirm`)}</ButtonText>
     </Button>
   )
 }