Skip to content

Commit

Permalink
Merge 110dd86 into 6721ae5
Browse files Browse the repository at this point in the history
  • Loading branch information
tlabaj committed Jan 29, 2019
2 parents 6721ae5 + 110dd86 commit 43626fc
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FunctionComponent, HTMLProps, ReactNode } from 'react';
export interface LoginMainHeaderProps extends HTMLProps<HTMLDivElement> {
children?: ReactNode;
className?: string;
dropdown?: ReactNode;
title?: string;
subtitle?: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const propTypes = {
children: PropTypes.node,
/** Additional classes added to the Login Main Header */
className: PropTypes.string,
/** Dropdown component for the Login Main Header */
dropdown: PropTypes.node,
/** Title for the Login Main Header */
title: PropTypes.string,
/** Subtitle that contains the Text, URL, and URL Text for the Login Main Header */
Expand All @@ -22,15 +20,13 @@ const propTypes = {
const defaultProps = {
children: null,
className: '',
dropdown: null,
title: '',
subtitle: ''
};

const LoginMainHeader = ({ children, className, dropdown, title, subtitle, ...props }) => (
const LoginMainHeader = ({ children, className, title, subtitle, ...props }) => (
<header className={css(styles.loginMainHeader, className)} {...props}>
{title && <Title size="3xl">{title}</Title>}
{dropdown}
{subtitle && <p>{subtitle}</p>}
{children}
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export interface LoginPageProps extends HTMLProps<HTMLElement> {
footerListVariants?: OneOf<typeof LoginListVariant, keyof typeof LoginListVariant>;
loginTitle: string;
signUpForAccountMessage?: ReactNode;
languageSelector?: ReactNode;
socialMediaLoginContent?: ReactNode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ const propTypes = {
footerListItems: PropTypes.node,
/** Adds list variant styles for the Footer List component of the LoginPage. Values are 'grid' or 'inline' */
footerListVariants: PropTypes.oneOf(Object.values(LoginListVariant)),
/** Language dropdown component for the Login Main Body Header of the LoginPage */
languageSelector: PropTypes.node,
/** Title for the Login Main Body Header of the LoginPage */
loginTitle: PropTypes.string.isRequired,
/** Login message that contains the Text, URL, and URL Text for the sign up for an account Login Message */
Expand All @@ -60,7 +58,6 @@ const defaultProps = {
footerListItems: null,
textContent: '',
footerListVariants: null,
languageSelector: null,
signUpForAccountMessage: null,
socialMediaLoginContent: null
};
Expand All @@ -75,7 +72,6 @@ const LoginPage = ({
textContent,
footerListItems,
footerListVariants,
languageSelector,
loginTitle,
signUpForAccountMessage,
socialMediaLoginContent,
Expand All @@ -98,7 +94,7 @@ const LoginPage = ({
<React.Fragment>
{backgroundImgSrc && <BackgroundImage src={backgroundImgSrc} alt={backgroundImgAlt} />}
<Login header={Header} footer={Footer} {...props} className={css(className)}>
<LoginMainHeader title={loginTitle} dropdown={languageSelector} subtitle={signUpForAccountMessage} />
<LoginMainHeader title={loginTitle} subtitle={signUpForAccountMessage} />
<LoginMainBody>{children}</LoginMainBody>
{socialMediaLoginContent && <LoginMainFooter>{socialMediaLoginContent}</LoginMainFooter>}
</Login>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
import LoginPage from './LoginPage';
import { Dropdown, DropdownItem } from '../Dropdown';

const dropdownToggle = jest.fn();

const myDropdown = (
<Dropdown toggle={dropdownToggle}>
<DropdownItem>English</DropdownItem>
</Dropdown>
);

const needAccountMesseage = (
<React.Fragment>
Expand All @@ -27,7 +18,6 @@ const props = {
textContent: 'This is placeholder text only.',
loginTitle: 'Log into your account',
signUpForAccountMessage: needAccountMesseage,
languageSelector: myDropdown,
socialMediaLoginContent: 'Footer'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,6 @@ exports[`check loginpage example against snapshot 1`] = `
>
<LoginMainHeader
className=""
dropdown={
<Dropdown
className=""
direction="down"
dropdownItems={Array []}
isOpen={false}
isPlain={false}
onSelect={[Function]}
position="left"
toggle={[MockFunction]}
>
<Item
className=""
component="a"
href="#"
isDisabled={false}
isHovered={false}
>
English
</Item>
</Dropdown>
}
subtitle={
<React.Fragment>
Login to your account
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import React from 'react';
import brandImg from './pf_logo_color.svg';
import {
Dropdown,
DropdownItem,
DropdownToggle,
LoginFooterItem,
LoginForm,
LoginPage,
BackgroundImageSrc,
ListItem
} from '@patternfly/react-core';
import { LoginFooterItem, LoginForm, LoginPage, BackgroundImageSrc, ListItem } from '@patternfly/react-core';

/**
* Note: When using background-filter.svg, you must also include #image_overlay as the fragment identifier
Expand All @@ -28,25 +19,12 @@ class SimpleLoginPage extends React.Component {
constructor(props) {
super(props);
this.state = {
isDropDownOpen: false,
usernameValue: '',
passwordValue: '',
isRememberMeChecked: false
};
}

onDropDownToggle = isOpen => {
this.setState({
isDropDownOpen: isOpen
});
};

onDropDownSelect = event => {
this.setState({
isDropDownOpen: !this.state.isDropDownOpen
});
};

handleUsernameChange = value => {
this.setState({ usernameValue: value });
};
Expand All @@ -60,20 +38,6 @@ class SimpleLoginPage extends React.Component {
};

render() {
const { isDropDownOpen } = this.state;
const dropdownItems = [
<DropdownItem key="english">English</DropdownItem>,
<DropdownItem key="spanish">Spanish</DropdownItem>
];
const languageDropdown = (
<Dropdown
dropdownItems={dropdownItems}
onSelect={this.onDropDownSelect}
toggle={<DropdownToggle onToggle={this.onDropDownToggle}>English</DropdownToggle>}
isOpen={isDropDownOpen}
/>
);

const signUpMessage = (
<React.Fragment>
Need an account? <a href="https://www.patternfly.org">Sign Up.</a>
Expand Down Expand Up @@ -125,7 +89,6 @@ class SimpleLoginPage extends React.Component {
application that may be relevant to users."
loginTitle="Log in to your account"
signUpForAccountMessage={signUpMessage}
languageSelector={languageDropdown}
>
{loginForm}
</LoginPage>
Expand Down

0 comments on commit 43626fc

Please sign in to comment.