Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozwiaczek committed Nov 12, 2020
1 parent 25d246c commit 00240f3
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# General
NODE_ENV=development

# AWS Amplify
AWS_DEFAULT_REGION=
COGNITO_USER_POOL_ID=
COGNITO_USER_POOL_CLIENT_ID=
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
"scripts": {
"storybook": "start-storybook -p 6006 -s public --no-dll",
"build-storybook": "build-storybook -s public --no-dll",
"build": "tsc --project tsconfig.json",
"build": "yarn clean && tsc --project tsconfig.json",
"build:watch": "yarn build -w",
"clean": "rimraf dist",
"type-check": "tsc",
"format": "prettier --write --config .prettierrc .",
"format:check": "prettier --check --config .prettierrc .",
Expand Down
8 changes: 4 additions & 4 deletions src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export interface FormProps {
onSuccessLoginMsg?: string;
initialValues?: any;
inputVariant?: 'filled' | 'outlined' | 'standard';
defaultValidationFields: DefaultAuthValidationOptions;
defaultValidationFields?: DefaultAuthValidationOptions;
validate?: (
values: any,
requiredChildren: Array<string>,
) => ValidationErrors | Promise<ValidationErrors>;
replacementValidate?: (values: any) => ValidationErrors | Promise<ValidationErrors>;
loading?: boolean;
className?: string;
confirmButtonLabel: string;
confirmButtonLabel?: string;
subheaderTitle?: string;
subheaderTitleVariant?: Variant;
subheaderContent?: string | JSX.Element;
Expand All @@ -71,13 +71,13 @@ export const Form: FC<FormProps> = ({
titleAlign = 'center',
initialValues = {},
inputVariant = 'outlined',
defaultValidationFields,
defaultValidationFields = [],
validate,
replacementValidate,
loading = false,
className,
children,
confirmButtonLabel,
confirmButtonLabel = 'Submit',
subheaderTitle,
subheaderTitleVariant = 'h5',
subheaderContent,
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export { ConfirmSignUp } from './containers/ConfirmSignUp/ConfirmSignUp';
export { ResendConfirmationCodeButton } from './containers/ConfirmSignUp/ResendConfirmationCodeButton';
export { useUser } from './hooks/useUser';
export { useSnackbar } from './hooks/useSnackbar';
export { styled } from './theme';
18 changes: 15 additions & 3 deletions src/providers/IntentbaseProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import { defaultTheme } from '../theme';
import { configureAmplify } from '../utils/configureAmplify';
import { SnackbarContextProvider } from './SnackbarProvider';

type Environment = 'production' | 'development' | 'test';

interface IntentbaseProps {
theme?: Partial<Theme> | ((outerTheme: Theme) => Theme);
region: string;
userPoolId: string;
userPoolWebClientId: string;
region?: string;
userPoolId?: string;
userPoolWebClientId?: string;
environment?: Environment;
}

export const IntentbaseProvider: FC<IntentbaseProps> = ({
Expand All @@ -19,8 +22,17 @@ export const IntentbaseProvider: FC<IntentbaseProps> = ({
userPoolId,
userPoolWebClientId,
theme = defaultTheme,
environment = 'production',
}) => {
if (!userPoolId || !userPoolWebClientId) {
if (environment !== 'production') {
return <h1>AWS Secrets required</h1>;
}
return null;
}

configureAmplify(region, userPoolId, userPoolWebClientId);

return (
<StylesProvider injectFirst>
<MuiThemeProvider theme={theme}>
Expand Down
5 changes: 4 additions & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createMuiTheme } from '@material-ui/core';
import { createMuiTheme, Theme } from '@material-ui/core';
import { red } from '@material-ui/core/colors';
import baseStyled, { ThemedStyledInterface } from 'styled-components';

export const defaultTheme = createMuiTheme({
palette: {
Expand All @@ -9,3 +10,5 @@ export const defaultTheme = createMuiTheme({
borderRadius: 10,
},
});

export const styled = baseStyled as ThemedStyledInterface<Theme>;
31 changes: 14 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2016",
"lib": ["dom", "dom.iterable", "esnext"],
"outDir": "./dist",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"jsx": "react",
"emitDeclarationOnly": true,
"isolatedModules": true,
"baseUrl": "src",
"rootDir": "src",
"sourceRoot": "/",
"jsx": "react",
"module": "esnext",
"moduleResolution": "node",
"preserveConstEnums": true,
"declaration": true,
"removeComments": true,
"sourceMap": true,
"inlineSources": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"traceResolution": true
"strict": true,
"skipLibCheck": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
Expand Down

0 comments on commit 00240f3

Please sign in to comment.