* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import styled from '@emotion/styled';
import classNames from 'classnames';
import * as React from 'react';
import HelpTooltip from '../../../components/controls/HelpTooltip';
export default function OAuthProviders(props: Props) {
const formatFunction = props.formatLabel || defaultFormatLabel;
return (
- <section className={classNames('oauth-providers', props.className)}>
- <ul>
- {props.identityProviders.map(identityProvider => (
- <OAuthProvider
- format={formatFunction}
- identityProvider={identityProvider}
- key={identityProvider.key}
- returnTo={props.returnTo}
- />
- ))}
- </ul>
- </section>
+ <Container className={classNames('oauth-providers', props.className)}>
+ {props.identityProviders.map(identityProvider => (
+ <OAuthProvider
+ format={formatFunction}
+ identityProvider={identityProvider}
+ key={identityProvider.key}
+ returnTo={props.returnTo}
+ />
+ ))}
+ </Container>
);
}
function OAuthProvider({ format, identityProvider, returnTo }: ItemProps) {
return (
- <li>
+ <IdentityProviderWrapper>
<IdentityProviderLink
backgroundColor={identityProvider.backgroundColor}
iconPath={identityProvider.iconPath}
{identityProvider.helpMessage && (
<HelpTooltip className="oauth-providers-help" overlay={identityProvider.helpMessage} />
)}
- </li>
+ </IdentityProviderWrapper>
);
}
function defaultFormatLabel(name: string) {
return translateWithParameters('login.login_with_x', name);
}
+
+const Container = styled.div`
+ display: inline-flex;
+ flex-direction: column;
+ align-items: stretch;
+`;
+
+const IdentityProviderWrapper = styled.div`
+ margin-bottom: 30px;
+`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render correctly 1`] = `
-<section
+<Styled(div)
className="oauth-providers"
>
- <ul>
- <OAuthProvider
- format={[Function]}
- identityProvider={
- Object {
- "backgroundColor": "#000",
- "iconPath": "/some/path",
- "key": "foo",
- "name": "Foo",
- }
+ <OAuthProvider
+ format={[Function]}
+ identityProvider={
+ Object {
+ "backgroundColor": "#000",
+ "iconPath": "/some/path",
+ "key": "foo",
+ "name": "Foo",
}
- key="foo"
- returnTo=""
- />
- <OAuthProvider
- format={[Function]}
- identityProvider={
- Object {
- "backgroundColor": "#00F",
- "helpMessage": "Help message!",
- "iconPath": "/icon/path",
- "key": "bar",
- "name": "Bar",
- }
+ }
+ key="foo"
+ returnTo=""
+ />
+ <OAuthProvider
+ format={[Function]}
+ identityProvider={
+ Object {
+ "backgroundColor": "#00F",
+ "helpMessage": "Help message!",
+ "iconPath": "/icon/path",
+ "key": "bar",
+ "name": "Bar",
}
- key="bar"
- returnTo=""
- />
- </ul>
-</section>
+ }
+ key="bar"
+ returnTo=""
+ />
+</Styled(div)>
`;
exports[`should render correctly 2`] = `
-<li>
+<Styled(div)>
<IdentityProviderLink
backgroundColor="#000"
iconPath="/some/path"
login.login_with_x.Foo
</span>
</IdentityProviderLink>
-</li>
+</Styled(div)>
`;
exports[`should render correctly 3`] = `
-<li>
+<Styled(div)>
<IdentityProviderLink
backgroundColor="#00F"
iconPath="/icon/path"
className="oauth-providers-help"
overlay="Help message!"
/>
-</li>
+</Styled(div)>
`;
exports[`should use the custom label formatter 1`] = `
-<li>
+<Styled(div)>
<IdentityProviderLink
backgroundColor="#000"
iconPath="/some/path"
custom_format.Foo
</span>
</IdentityProviderLink>
-</li>
+</Styled(div)>
`;