Skip to content

Commit

Permalink
Merge pull request #662 from puppetlabs/CDPE-6574/update-authenticati…
Browse files Browse the repository at this point in the history
…on-component

(CDPE-6574) Update authentication component
  • Loading branch information
petergmurphy committed Apr 11, 2024
2 parents 5c4bc31 + 2aa7e20 commit 032d822
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 29 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## react-components 5.34.8 (2024-04-10)

- [Logo] Revert continuous delivery logo viewBox size due to alignment issues (by [@petergmurphy](https://github.com/petergmurphy))

## react-layouts 2.0.0-alpha.11 (2024-04-10)

- [Authentication] Update Authentication component to support a footer prop (by [@petergmurphy](https://github.com/petergmurphy))

## react-components 5.34.7 (2024-04-03)

- [Popover] Add new side prop options to enable rendering the arrow in all corners of the box (by [@sean-mckenna](https://github.com/sean-mckenna)) in [#661](https://github.com/puppetlabs/design-system/pull/661))
Expand Down
4 changes: 2 additions & 2 deletions packages/react-components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/react-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@puppet/react-components",
"version": "5.34.7",
"version": "5.34.8",
"author": "Puppet, Inc.",
"license": "Apache-2.0",
"main": "build/library.js",
Expand Down Expand Up @@ -91,4 +91,4 @@
"regenerator-runtime": "^0.13.7",
"scroll-into-view-if-needed": "^2.2.25"
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/react-layouts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/react-layouts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@puppet/react-layouts",
"version": "2.0.0-alpha.10",
"version": "2.0.0-alpha.11",
"author": "Puppet, Inc.",
"license": "Apache-2.0",
"main": "dist/react-layouts.js",
Expand Down Expand Up @@ -93,4 +93,4 @@
"webpack-merge": "^4.2.2",
"webpack-node-externals": "^1.7.2"
}
}
}
37 changes: 22 additions & 15 deletions packages/react-layouts/src/Authentication/Authentication.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ const propTypes = {
className: PropTypes.string,
/** Content, rendered inside a centered card */
children: PropTypes.node,
/** Footer content, rendered below the card */
footer: PropTypes.node,
};

const defaultProps = {
subtitle: '',
className: '',
children: null,
footer: null,
};

const Authentication = ({
Expand All @@ -34,6 +37,7 @@ const Authentication = ({
subtitle,
className,
children,
footer,
...rest
}) => {
const logoType = Logo.SUPPORTED_LOGOS.includes(product) ? 'full' : 'bug';
Expand All @@ -45,21 +49,24 @@ const Authentication = ({
innerClassName="rl-authentication"
{...rest}
>
<Logo
type={logoType}
className={classNames(
'rl-authentication-logo',
`rl-authentication-logo-${logoType}`,
)}
product={product}
/>
<Card className="rl-authentication-content">
<div className="rl-authentication-title">
<Heading as="h3">{title}</Heading>
<div className="rl-authentication-subtitle">{subtitle}</div>
</div>
{children}
</Card>
<div className="rl-authentication-content">
<Logo
type={logoType}
className={classNames(
'rl-authentication-logo',
`rl-authentication-logo-${logoType}`,
)}
product={product}
/>
<Card className="rl-authentication-card">
<div className="rl-authentication-title">
<Heading as="h2">{title}</Heading>
<div className="rl-authentication-subtitle">{subtitle}</div>
</div>
{children}
</Card>
</div>
{footer && <footer className="rl-authentication-footer">{footer}</footer>}
</PageContent>
);
};
Expand Down
23 changes: 21 additions & 2 deletions packages/react-layouts/src/Authentication/Authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,28 @@
# Example: Login

```jsx
import { Form } from '@puppet/react-components';
import { Form, Logo } from '@puppet/react-components';

const FooterExample = () => {
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
gap: '10px',
}}
>
<Logo style={{ height: '19px' }} product="puppet-standalone" />
Puppet | Footer example
</div>
);
};

<Authentication product="My Product" title="Sign in to My Product">
<Authentication
product="My Product"
title="Sign in to My Product"
footer={<FooterExample />}
>
<Form submittable actionsPosition="block" submitLabel="Sign in">
<Form.Field
type="email"
Expand Down
13 changes: 10 additions & 3 deletions packages/react-layouts/src/Authentication/Authentication.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
min-height: 100%;
gap: 32px;
}

.rl-authentication-logo {
Expand All @@ -26,10 +25,18 @@
}

.rl-authentication-content {
display: flex;
flex-direction: column;
flex: 1;
justify-content: center;
align-items: center;
}

.rl-authentication-card {
display: flex;
margin-top: 32px;
max-width: 410px;
padding: 48px;
max-width: 500px;
width: 100%;
}

Expand Down

0 comments on commit 032d822

Please sign in to comment.