Skip to content

Commit

Permalink
fix(UniversalAuth): go to login page when click enter button
Browse files Browse the repository at this point in the history
  • Loading branch information
wlliaml committed Oct 11, 2023
1 parent 37e04a6 commit 713877a
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions src/components/Buttons/UniversalAuth/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import React from 'react'

import { CLOSE_ACTIVE_DIALOG, OPEN_UNIVERSAL_AUTH_DIALOG } from '~/common/enums'
import { analytics } from '~/common/utils'
import { Button, TextIcon, Translate } from '~/components'
import {
CLOSE_ACTIVE_DIALOG,
OPEN_UNIVERSAL_AUTH_DIALOG,
PATHS,
} from '~/common/enums'
import { analytics, appendTarget } from '~/common/utils'
import { Button, Media, TextIcon, Translate } from '~/components'

export const UniversalAuthButton: React.FC = () => {
const props = {
const smUpProps = {
onClick: () => {
analytics.trackEvent('click_button', {
type: 'login/signup',
Expand All @@ -15,6 +19,15 @@ export const UniversalAuthButton: React.FC = () => {
},
}

const smProps = {
...appendTarget(PATHS.LOGIN, true),
onClick: () => {
analytics.trackEvent('click_button', {
type: 'login/signup',
})
},
}

const ButtonText = () => (
<TextIcon color="white" weight="md">
<Translate id="authEntries" />
Expand All @@ -23,9 +36,17 @@ export const UniversalAuthButton: React.FC = () => {

return (
<>
<Button bgColor="green" spacing={['tight', 'base']} {...props}>
<ButtonText />
</Button>
<Media lessThan="lg">
<Button bgColor="green" spacing={['tight', 'base']} {...smProps}>
<ButtonText />
</Button>
</Media>

<Media greaterThanOrEqual="lg">
<Button bgColor="green" spacing={['tight', 'base']} {...smUpProps}>
<ButtonText />
</Button>
</Media>
</>
)
}

0 comments on commit 713877a

Please sign in to comment.