generated from codinsonn/universal-app-router
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
18 changed files
with
461 additions
and
98 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
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
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,51 @@ | ||
import React from 'react' | ||
import { View, Text, Link } from '../components/styled' | ||
import { useRouter } from '@green-stack/navigation/useRouter' | ||
import { ArrowLeftFilled } from '../icons/ArrowLeftFilled' | ||
import { schema, z } from '@green-stack/schemas' | ||
|
||
/* --- Props ----------------------------------------------------------------------------------- */ | ||
|
||
const BackButtonProps = schema('BackButtonProps', { | ||
backLink: z.string().default('/'), | ||
}) | ||
|
||
type BackButtonProps = z.input<typeof BackButtonProps> | ||
|
||
/* --- <BackButton/> --------------------------------------------------------------------------- */ | ||
|
||
const BackButton = (props: BackButtonProps) => { | ||
// Props | ||
const { backLink } = BackButtonProps.applyDefaults(props) | ||
|
||
// Routing | ||
const { canGoBack, back } = useRouter() | ||
|
||
// Vars | ||
const showBackButton = canGoBack() | ||
|
||
// -- Render -- | ||
|
||
return ( | ||
<View className="flex flex-row absolute top-8 web:top-0 left-0 p-4 items-center"> | ||
<ArrowLeftFilled fill="#FFFFFF" size={18} /> | ||
<View className="w-[5px]" /> | ||
{showBackButton ? ( | ||
<Text | ||
className="text-white text-lg" | ||
onPress={back} | ||
> | ||
{`Back`} | ||
</Text> | ||
) : ( | ||
<Link href={backLink} className="text-white text-lg no-underline"> | ||
{`Back`} | ||
</Link> | ||
)} | ||
</View> | ||
) | ||
} | ||
|
||
/* --- Exports --------------------------------------------------------------------------------- */ | ||
|
||
export default BackButton |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
export const testableFeatures = [ | ||
{ | ||
title: 'Test Images?', | ||
link: '/images' | ||
}, | ||
] |
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,28 @@ | ||
import * as React from 'react' | ||
import Svg, { Path } from 'react-native-svg' | ||
import type { SvgProps } from 'react-native-svg' | ||
|
||
/* --- Types ----------------------------------------------------------------------------------- */ | ||
|
||
type IconProps = SvgProps & { fill?: string; stroke?: string; size?: number } | ||
|
||
/* --- <ArrowLeftFilled/> --------------------------------------------------------------------- */ | ||
|
||
export const ArrowLeftFilled = ({ size = 24, fill = '#333333', ...svgProps }: IconProps) => ( | ||
<Svg width={size} height={size} fill="none" viewBox="0 0 24 24" {...svgProps}> | ||
<Path | ||
d="M10 6L4 12L10 18" | ||
stroke={fill} | ||
strokeWidth="4" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<Path | ||
d="M20 12H4" | ||
stroke={fill} | ||
strokeWidth="4" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</Svg> | ||
) |
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,28 @@ | ||
import * as React from 'react' | ||
import Svg, { Path } from 'react-native-svg' | ||
import type { SvgProps } from 'react-native-svg' | ||
|
||
/* --- Types ----------------------------------------------------------------------------------- */ | ||
|
||
type IconProps = SvgProps & { fill?: string; stroke?: string; size?: number } | ||
|
||
/* --- <ArrowRightFilled/> --------------------------------------------------------------------- */ | ||
|
||
export const ArrowRightFilled = ({ size = 24, fill = '#333333', ...svgProps }: IconProps) => ( | ||
<Svg width={size} height={size} fill="none" viewBox="0 0 24 24" {...svgProps}> | ||
<Path | ||
d="M14 6L20 12L14 18" | ||
stroke={fill} | ||
strokeWidth="4" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<Path | ||
d="M4 12H20" | ||
stroke={fill} | ||
strokeWidth="4" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</Svg> | ||
) |
Oops, something went wrong.