Skip to content

Commit 7f4248d

Browse files
dbanksdesignErikCHwlee221ioanabrookscalebpollman
authored
feat(file-uploader): Merge to main (#3028)
Co-authored-by: Erik Hanchett <[email protected]> Co-authored-by: William Lee <[email protected]> Co-authored-by: Ioana Brooks <[email protected]> Co-authored-by: Caleb Pollman <[email protected]>
1 parent d5cf586 commit 7f4248d

File tree

119 files changed

+5077
-153
lines changed

Some content is hidden

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

119 files changed

+5077
-153
lines changed

.changeset/small-dancers-cheer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@aws-amplify/ui-react': minor
3+
'@aws-amplify/ui': minor
4+
---
5+
6+
Added the FileUploader component. The File Uploader lets your users upload files to the cloud. For more information follow the instructions. https://ui.docs.amplify.aws/react/connected-components/storage/fileuploader
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Description: This workflow runs unit + e2e tests
2+
#
3+
# Triggered by: merge to `fileuploader/main` branch
4+
5+
name: Publish / fileuploader
6+
7+
on:
8+
push:
9+
branches: [fileuploader/release]
10+
11+
jobs:
12+
publish:
13+
uses: ./.github/workflows/reusable-tagged-publish.yml
14+
with:
15+
dist-tag: fileuploader
16+
secrets:
17+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

docs/next.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path');
22
const { execSync } = require('child_process');
33

4+
const reHypeIgnoreLines = require('./src/plugins/rehype-ignore-code');
45
const gitHead = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
56

67
const BRANCH = gitHead === 'HEAD' ? 'main' : gitHead;
@@ -14,6 +15,8 @@ module.exports = withNextPluginPreval({
1415
DOCSEARCH_DOCS_APP_ID: process.env.DOCSEARCH_DOCS_APP_ID,
1516
DOCSEARCH_DOCS_API_KEY: process.env.DOCSEARCH_DOCS_API_KEY,
1617
DOCSEARCH_DOCS_INDEX_NAME: process.env.DOCSEARCH_DOCS_INDEX_NAME,
18+
FF_FILEUPLOADER_COMPONENTS_ENABLED:
19+
process.env.FF_FILEUPLOADER_COMPONENTS_ENABLED,
1720
},
1821
// Differentiate pages with frontmatter & layout vs. normal MD(X)
1922
pageExtensions: ['page.mdx', 'page.tsx'],
@@ -158,6 +161,11 @@ module.exports = withNextPluginPreval({
158161

159162
webpack(config) {
160163
const defaultRehypePlugins = [
164+
// This is a custom plugin that removes lines that end in `// IGNORE`
165+
// This allows us to include code necessary for an example to run
166+
// but that should not be in customer's code. For example, using a
167+
// plugin to make mock a connected component.
168+
reHypeIgnoreLines,
161169
require('mdx-prism'),
162170
// TODO: these are older versions of these packages because the newer versions
163171
// are ESM only.

docs/src/components/ComponentVariableTable.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ function extractClasses(themeObject) {
66
const themeKeys = Object.keys(themeObject);
77
let classNames = [];
88
themeKeys.forEach((key) => {
9-
if (themeObject[key]?.name) {
9+
// 'value' is a special attribute, only design tokens will have 'value'
10+
// however, there could be a 'name' in part of the object
11+
if (themeObject[key]?.value) {
1012
classNames.push(themeObject[key].name);
1113
} else if (typeof themeObject[key] === 'object') {
1214
classNames = classNames.concat(extractClasses(themeObject[key]));
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const FeatureFlagSection = ({ children, featureFlag }) => {
2+
if (!featureFlag) return null;
3+
return children;
4+
};

docs/src/data/links.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ export const connectedComponents: ComponentNavItem[] = [
134134
body: 'Amplify UI Geo provides UI components for maps and location search built on top of Amazon Location Service.',
135135
platforms: ['react'],
136136
},
137+
{
138+
href: '/connected-components/storage',
139+
label: 'Storage',
140+
body: "Amplify UI Storage components allow you to store files in the cloud using Amplify's Storage category",
141+
platforms: ['react'],
142+
},
143+
{
144+
href: '/connected-components/storage/fileuploader',
145+
label: 'File Uploader',
146+
body: 'FileUploader component allows users to upload files to your Amplify backend.',
147+
platforms: ['react'],
148+
tertiary: true,
149+
},
137150
{
138151
href: '/connected-components/in-app-messaging',
139152
label: 'In-App Messaging',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { FileUploader } from '@aws-amplify/ui-react';
2+
3+
export const AcceptedFileTypesExample = () => {
4+
return (
5+
<FileUploader
6+
acceptedFileTypes={['.gif', '.bmp', '.doc', '.jpeg', '.jpg']}
7+
variation="drop"
8+
accessLevel="public"
9+
provider="fast" // IGNORE
10+
/>
11+
);
12+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { FileUploader } from '@aws-amplify/ui-react';
2+
3+
export const AutoProceedExample = () => {
4+
return (
5+
<FileUploader
6+
shouldAutoProceed={true}
7+
acceptedFileTypes={['image/*']}
8+
accessLevel="public"
9+
provider="fast" // IGNORE
10+
/>
11+
);
12+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { FileUploader } from '@aws-amplify/ui-react'; // IGNORE
2+
export const DefaultFileUploaderExample = () => {
3+
return (
4+
<FileUploader
5+
acceptedFileTypes={['image/*']}
6+
accessLevel="public"
7+
provider="fast" // IGNORE
8+
/>
9+
);
10+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { FileUploader, View, Text } from '@aws-amplify/ui-react';
2+
3+
export const FileUploaderComponentsExample = () => {
4+
return (
5+
<FileUploader
6+
variation="drop"
7+
acceptedFileTypes={['image/*']}
8+
accessLevel="public"
9+
// components={{
10+
// UploadDropZone: ({ inDropZone, children, ...rest }) => {
11+
// return (
12+
// <View
13+
// padding="xl"
14+
// backgroundColor={
15+
// inDropZone ? 'brand.secondary.40' : 'brand.secondary.20'
16+
// }
17+
// {...rest}
18+
// >
19+
// <Text textAlign="center">Drop files here</Text>
20+
// </View>
21+
// );
22+
// },
23+
// }}
24+
provider="fast" // IGNORE
25+
/>
26+
);
27+
};

0 commit comments

Comments
 (0)