Skip to content

Commit afe273e

Browse files
joebuonoJoe Buonocalebpollmansreeramsamawlee221
authored
chore(docs): Add RNA pages to docs site (#3041)
Co-authored-by: Joe Buono <[email protected]> Co-authored-by: Caleb Pollman <[email protected]> Co-authored-by: Sreeram Sama <[email protected]> Co-authored-by: William Lee <[email protected]> Co-authored-by: MJ Zhang <[email protected]> Co-authored-by: 0618 <[email protected]> Co-authored-by: Danny Banks <[email protected]>
1 parent ce3378e commit afe273e

File tree

85 files changed

+1528
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1528
-224
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
node_modules
66
aws-exports.js
77
aws-exports.ts
8-
!examples/**/aws-exports.js
8+
9+
# We have mock exports in the following locations
10+
!examples/angular/src/pages/ui/components/*/*/aws-exports.js
11+
!examples/next/pages/ui/components/*/*/aws-exports.js
12+
!examples/vue/src/pages/ui/components/*/*/aws-exports.js
13+
!examples/react-native/src/features/*/*/aws-exports.js
14+
915
# .npmrc is used in our deployment procedure to login to npm. Ignored for security.
1016
.npmrc
1117
# used by turbo for logs

docs/src/components/Layout/Sidebar.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,19 +184,16 @@ const SecondaryNav = (props) => {
184184
))}
185185
</ExpanderItem>
186186

187-
{/* React Native does not yet support theming */}
188-
{isReactNative ? null : (
189-
<ExpanderItem
190-
title={<ExpanderTitle Icon={MdOutlineAutoAwesome} text="Theming" />}
191-
value="theming"
192-
>
193-
{theming.map(({ label, ...rest }) => (
194-
<NavLink key={label} {...rest} onClick={props.onClick}>
195-
{label}
196-
</NavLink>
197-
))}
198-
</ExpanderItem>
199-
)}
187+
<ExpanderItem
188+
title={<ExpanderTitle Icon={MdOutlineAutoAwesome} text="Theming" />}
189+
value="theming"
190+
>
191+
{theming.map(({ label, ...rest }) => (
192+
<NavLink key={label} {...rest} onClick={props.onClick}>
193+
{label}
194+
</NavLink>
195+
))}
196+
</ExpanderItem>
200197

201198
{/* Flutter and React Native don't have guides at this time */}
202199
{isFlutter || isReactNative ? null : (

docs/src/components/home/sections/AuthenticationSection.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,48 @@ export default function App() {
9999
);
100100
}
101101
}`,
102+
'react-native': `import React from 'react';
103+
import { Button } from 'react-native';
104+
105+
import { Amplify } from 'aws-amplify';
106+
import { Authenticator, useAuthenticator } from '@aws-amplify/ui-react-native';
107+
108+
import awsExports from './aws-exports';
109+
Amplify.configure(awsExports);
110+
111+
function SignOutButton() {
112+
const { signOut } = useAuthenticator();
113+
return <Button title="Sign Out" onPress={signOut} />;
114+
}
115+
116+
function App() {
117+
return (
118+
<Authenticator.Provider>
119+
<Authenticator>
120+
<SignOutButton />
121+
</Authenticator>
122+
</Authenticator.Provider>
123+
);
124+
}
125+
126+
export default App;
127+
`,
102128
};
103129

104130
const languages = {
105131
react: 'jsx',
106132
angular: 'javascript', // is this the best primsa language?
107133
vue: 'javascript',
108134
flutter: 'dart',
135+
'react-native': 'jsx',
109136
};
110137

111138
const fileName = {
112139
react: 'index.tsx',
113140
angular: 'index.html',
114141
vue: 'index.vue',
115142
flutter: 'main.dart',
143+
'react-native': 'App.jsx',
116144
};
117145

118146
export const AuthenticationSection = ({ platform }) => {
@@ -172,7 +200,7 @@ export const AuthenticationSection = ({ platform }) => {
172200
<View flex="1">
173201
<FlutterAuthenticatorExample id="flutter-authenticator-home" />
174202
</View>
175-
) : (
203+
) : platform === 'react-native' ? null : (
176204
<BrowserMock flex="1" location="https://localhost">
177205
<Authenticator />
178206
</BrowserMock>

docs/src/components/home/sections/CompatibleSection.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ export const CompatibleSection = ({ platform }) => {
4646
UI-less, implementations that handle complex state management and
4747
leave the UI up to you.
4848
</HomeFeatureCard>
49-
<HomeFeatureCard icon={MdOutlineFlashOff} title="Styling optional">
50-
Don&lsquo;t like our style? Throw it out and use your own! Amplify
51-
UI components use plain CSS so you have complete control over the
52-
styling.
53-
</HomeFeatureCard>
49+
{platform === 'react-native' ? null : (
50+
<HomeFeatureCard icon={MdOutlineFlashOff} title="Styling optional">
51+
Don&lsquo;t like our style? Throw it out and use your own! Amplify
52+
UI components use plain CSS so you have complete control over the
53+
styling.
54+
</HomeFeatureCard>
55+
)}
56+
5457
<HomeFeatureCard
5558
icon={SiTypescript}
5659
title="TypeScript & IntelliSense"

docs/src/data/frameworks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const FRAMEWORK_DISPLAY_NAMES: Record<Framework, string> = {
2424

2525
// React Native requires direct installation of dependencies with native modules
2626
export const REACT_NATIVE_DEPENDENCIES =
27-
'react-native-safe-area-context @react-native-community/netinfo @react-native-async-storage/async-storage react-native-get-random-values react-native-url-polyfill';
27+
'react-native-safe-area-context amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage react-native-get-random-values react-native-url-polyfill';
2828

2929
export const FRAMEWORK_INSTALL_SCRIPTS = {
3030
react: 'npm i @aws-amplify/ui-react aws-amplify',

docs/src/data/links.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,24 @@ export const connectedComponents: ComponentNavItem[] = [
108108
href: '/connected-components/authenticator',
109109
label: 'Authenticator',
110110
body: 'The Authenticator component adds complete authentication flows to your application with minimal boilerplate.',
111-
platforms: ['react', 'vue', 'angular', 'flutter'],
111+
platforms: ['react', 'vue', 'angular', 'flutter', 'react-native'],
112112
},
113113
{
114114
href: '/connected-components/authenticator/configuration',
115115
label: 'Configuration',
116-
platforms: ['react', 'vue', 'angular', 'flutter'],
116+
platforms: ['react', 'vue', 'angular', 'flutter', 'react-native'],
117117
tertiary: true,
118118
},
119119
{
120120
href: '/connected-components/authenticator/customization',
121121
label: 'Customization',
122-
platforms: ['react', 'vue', 'angular', 'flutter'],
122+
platforms: ['react', 'vue', 'angular', 'flutter', 'react-native'],
123123
tertiary: true,
124124
},
125125
{
126126
href: '/connected-components/authenticator/headless',
127127
label: 'Headless Usage',
128-
platforms: ['react', 'vue', 'angular'],
128+
platforms: ['react', 'vue', 'angular', 'react-native'],
129129
tertiary: true,
130130
},
131131
{
@@ -497,7 +497,7 @@ export const theming: ComponentNavItem[] = [
497497
{
498498
href: '/theming',
499499
label: 'Overview',
500-
platforms: ['react', 'vue', 'angular', 'flutter'],
500+
platforms: ['react', 'vue', 'angular', 'flutter', 'react-native'],
501501
},
502502
{
503503
href: '/theming/responsive',
@@ -530,7 +530,7 @@ export const theming: ComponentNavItem[] = [
530530
{
531531
href: '/theming/dark-mode',
532532
label: 'Dark mode',
533-
platforms: ['react', 'vue', 'angular', 'flutter'],
533+
platforms: ['react', 'vue', 'angular', 'flutter', 'react-native'],
534534
},
535535
{
536536
href: '/theming/css-variables',
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Alert } from '@aws-amplify/ui-react';
2+
import { useRouter } from 'next/router';
3+
4+
export const DeveloperPreview = () => {
5+
const {
6+
query: { platform = 'react' },
7+
} = useRouter();
8+
if (platform !== 'react-native') return null;
9+
10+
return (
11+
<Alert variation="info" heading="Developer Preview">
12+
The React Native Authenticator is currently in developer preview.
13+
</Alert>
14+
);
15+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```jsx{19} file=../../../../../../../examples/react-native/src/features/Authenticator/HideSignUp/Example.tsx
2+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Example } from '@/components/Example';
2+
import { Fragment } from '@/components/Fragment';
3+
import { Authenticator } from '@aws-amplify/ui-react';
4+
5+
## Hide Sign Up
6+
7+
The Authenticator has an option to hide the sign up page including the `Create Account` button.
8+
9+
<Fragment>
10+
{({ platform }) => import(`./hidesignup.default.${platform}.mdx`)}
11+
</Fragment>

docs/src/pages/[platform]/connected-components/authenticator/configuration/index.page.mdx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
title: Configuration
33
metaTitle: Configuration
44
description: How to setup and configure your Authenticator component.
5-
supportedFrameworks: react|angular|vue|flutter
5+
supportedFrameworks: all
66
---
77

88
import { Fragment } from '@/components/Fragment';
99
import { Alert, Tabs, TabItem } from '@aws-amplify/ui-react';
1010
import { FRAMEWORKS } from '@/data/frameworks';
1111
import { getCustomStaticPath } from '@/utils/getCustomStaticPath';
12+
import { DeveloperPreview } from '../DeveloperPreview';
1213

1314
export async function getStaticPaths() {
1415
return getCustomStaticPath(frontmatter.supportedFrameworks);
@@ -20,6 +21,8 @@ export async function getStaticProps() {
2021
return { props: {} }
2122
}
2223

24+
<DeveloperPreview />
25+
2326
<Alert role="none" heading="Wait!">
2427
Did you follow the [quick start instructions](/connected-components/authenticator#quick-start) to set up the Authenticator first?
2528
</Alert>
@@ -33,7 +36,7 @@ By default, unauthenticated users are redirected to the Sign In flow. You can ex
3336
<Fragment>
3437
{({ platform }) => import(`./initialState.signIn.${platform}.mdx`)}
3538
</Fragment>
36-
<Fragment useCommonWebContent>
39+
<Fragment platforms={['web', 'flutter']} useCommonWebContent>
3740
{({ platform }) =>
3841
import(`./initialState.signIn.example.${platform}.mdx`)
3942
}
@@ -43,7 +46,7 @@ By default, unauthenticated users are redirected to the Sign In flow. You can ex
4346
<Fragment>
4447
{({ platform }) => import(`./initialState.signUp.${platform}.mdx`)}
4548
</Fragment>
46-
<Fragment useCommonWebContent>
49+
<Fragment platforms={['web', 'flutter']} useCommonWebContent>
4750
{({ platform }) =>
4851
import(`./initialState.signUp.example.${platform}.mdx`)
4952
}
@@ -53,7 +56,7 @@ By default, unauthenticated users are redirected to the Sign In flow. You can ex
5356
<Fragment>
5457
{({ platform }) => import(`./initialState.resetPassword.${platform}.mdx`)}
5558
</Fragment>
56-
<Fragment useCommonWebContent>
59+
<Fragment platforms={['web', 'flutter']} useCommonWebContent>
5760
{({ platform }) =>
5861
import(`./initialState.resetPassword.example.${platform}.mdx`)
5962
}
@@ -86,7 +89,7 @@ with the exception of `address`, `gender`, `locale`, `picture`, `updated_at`, an
8689
<Fragment>
8790
{({ platform }) => import(`./signUpAttributes.default.${platform}.mdx`)}
8891
</Fragment>
89-
<Fragment useCommonWebContent>
92+
<Fragment platforms={['web', 'flutter']} useCommonWebContent>
9093
{({ platform }) =>
9194
import(`./signUpAttributes.default.example.${platform}.mdx`)
9295
}
@@ -96,24 +99,22 @@ with the exception of `address`, `gender`, `locale`, `picture`, `updated_at`, an
9699
<Fragment>
97100
{({ platform }) => import(`./signUpAttributes.all.${platform}.mdx`)}
98101
</Fragment>
99-
<Fragment useCommonWebContent>
102+
<Fragment platforms={['web', 'flutter']} useCommonWebContent>
100103
{({ platform }) =>
101104
import(`./signUpAttributes.all.example.${platform}.mdx`)
102105
}
103106
</Fragment>
104107
</TabItem>
105108
</Tabs>
106109

107-
## Social Providers
108-
109-
<Fragment useCommonWebContent>
110+
<Fragment useCommonWebContent platforms={['web', 'flutter']}>
110111
{({ platform }) => import(`./socialProviders.${platform}.mdx`)}
111112
</Fragment>
112113

113114
<Fragment useCommonWebContent platforms={['web']}>
114115
{({ platform }) => import(`./variation.${platform}.mdx`)}
115116
</Fragment>
116117

117-
<Fragment useCommonWebContent platforms={['web']}>
118+
<Fragment useCommonWebContent platforms={['web', 'react-native']}>
118119
{({ platform }) => import(`./hidesignup.${platform}.mdx`)}
119120
</Fragment>

0 commit comments

Comments
 (0)