/*
* Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import * as React from 'react';
import { objectLessAttributes } from '@aws-amplify/core';
import AmplifyTheme from './AmplifyTheme';
export const Container = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.container);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const FormContainer = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.formContainer);
return beforeAfter(
{props.children}
);
};
export const FormSection = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.formSection);
return (
{beforeAfter(
{props.children}
)}
);
};
export const ErrorSection = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.errorSection);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const ErrorSectionContent = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.errorSectionContent);
return beforeAfter(
{props.children}
);
};
export const SectionHeader = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.sectionHeader);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const SectionHeaderContent = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.sectionHeaderContent);
return beforeAfter(
{props.children}
);
};
export const SectionFooter = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.sectionFooter);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const SectionFooterContent = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.sectionFooterContent);
return beforeAfter(
{props.children}
);
};
export const SectionBody = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.sectionBody);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const ActionRow = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.actionRow);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const FormRow = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.formRow);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const InputRow = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.input);
const p = objectLessAttributes(props, 'theme');
return (
{beforeAfter( )}
);
};
export const RadioRow = props => {
const id = props.id || '_' + props.value;
const theme = props.theme || AmplifyTheme;
return (
{props.placeholder}
);
};
export const Radio = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.radio);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
);
};
export const CheckboxRow = props => {
const id = props.id || '_' + props.name;
const theme = props.theme || AmplifyTheme;
return (
{props.placeholder}
);
};
export const Checkbox = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.checkbox);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
);
};
export const MessageRow = props => {
const theme = props.theme || AmplifyTheme;
return (
{props.children}
);
};
export const MessageContent = props => {
const theme = props.theme || AmplifyTheme;
return beforeAfter(
{props.children}
);
};
export const ButtonRow = props => {
const theme = props.theme || AmplifyTheme;
return beforeAfter(
);
};
export const Button = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.button);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const ButtonContent = props => {
const theme = props.theme || AmplifyTheme;
return beforeAfter(
{props.children}
);
};
export const SignInButton = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.signInButton);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const Link = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.a);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const Label = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.label);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const Space = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.space);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const NavBar = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.navBar);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const Nav = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.nav);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const NavRight = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.navRight);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const NavItem = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.navItem);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{props.children}
);
};
export const NavButton = props => {
const theme = props.theme || AmplifyTheme;
const style = propStyle(props, theme.navButton);
const p = objectLessAttributes(props, 'theme');
return beforeAfter(
{beforeAfter(
{props.children}
)}
);
};
export const beforeAfter = el => {
const style = el.props.style || {};
const { before, after } = style;
if (!before && !after) {
return el;
}
return (
{before ? {before.content} : null}
{el}
{after ? {after.content} : null}
);
};
export const propStyle = (props, themeStyle) => {
const { id, style } = props;
const styl = Object.assign({}, style, themeStyle);
if (!id) {
return styl;
}
const selector = '#' + id;
Object.assign(styl, styl[selector]);
return styl;
};
export const transparent1X1 =
'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
export const white1X1 =
'data:image/gif;base64,R0lGODlhAQABAIAAAP7//wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';