()
| 11 | import { useViewSize, ViewSize } from '@dailydotdev/shared/src/hooks'; |
| 12 | |
| 13 | export const PlusHeader = (): ReactElement | null => { |
| 14 | const isMobile = useViewSize(ViewSize.MobileL); |
| 15 | const { back, replace, isReady } = useRouter(); |
| 16 | |
| 17 | const onBackClick = useCallback(() => { |
| 18 | if (window.history?.length > 1) { |
| 19 | back(); |
| 20 | } else { |
| 21 | replace(webappUrl); |
| 22 | } |
| 23 | }, [back, replace]); |
| 24 | |
| 25 | if (!isReady) { |
| 26 | return null; |
| 27 | } |
| 28 | |
| 29 | return ( |
| 30 | <header className="flex h-16 w-full items-center justify-center gap-4 border-b border-border-subtlest-tertiary bg-background-default px-4 tablet:bg-transparent laptop:justify-start"> |
| 31 | <Button |
| 32 | variant={isMobile ? ButtonVariant.Tertiary : ButtonVariant.Float} |
| 33 | icon={<ArrowIcon className="-rotate-90" />} |
| 34 | onClick={onBackClick} |
| 35 | className="absolute left-4 laptop:relative laptop:left-0" |
| 36 | > |
| 37 | {!isMobile ? 'Back' : undefined} |
| 38 | </Button> |
| 39 | <LogoWithPlus /> |
| 40 | </header> |
| 41 | ); |
| 42 | }; |
nothing calls this directly
no test coverage detected