Skip to content

Commit

Permalink
feat(page8): add new component.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 29, 2023
1 parent f60f3e2 commit 2d0d0ec
Show file tree
Hide file tree
Showing 19 changed files with 1,164 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pages/page7/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ const LoginPage: FC<PropsWithChildren<React.HTMLAttributes<HTMLDivElement>>> = (
<Submit />
<Container {...divProps} className={`login-page7 ${className || ''}`}>
<RenderLogin />
{children}
</Container>
{children}
</Provider>
);
};
Expand Down
366 changes: 366 additions & 0 deletions pages/page8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,366 @@
# @react-login-page/page8

[![npm version](https://img.shields.io/npm/v/@react-login-page/page8.svg)](https://www.npmjs.com/package/@react-login-page/page8)
[![Downloads](https://img.shields.io/npm/dm/@react-login-page/page8.svg?style=flat)](https://www.npmjs.com/package/@react-login-page/page8)

<!--rehype:ignore:start-->
<a href="https://uiwjs.github.io/react-login-page">
<img width="571" alt="login-page" src="https://user-images.githubusercontent.com/1680273/234621367-3c58dcb4-0b66-4e93-aa07-0cf34ee4c752.png">
</a>

<!--rehype:ignore:end-->

## Install

```bash
$ npm install @react-login-page/page8 --save
```

## Usage

```jsx
import React from 'react';
import Login from '@react-login-page/page8';

const Demo = () => <Login style={{ height: 690 }} />;

export default Demo;
```

## Modify Controls

```jsx mdx:preview
import React from 'react';
import LoginPage, { Username, Password, Submit, Title, Logo } from '@react-login-page/page8';
import LoginLogo from 'react-login-page/logo';

const styles = { height: 690 };

const Demo = () => (
<div style={styles}>
<LoginPage>
<Title />
<Logo>
<LoginLogo />
</Logo>
<Username label="用户名" placeholder="请输入用户名" name="userUserName" />
<Password label="密码" placeholder="请输入密码" name="userPassword" />
<Submit keyname="submit">提交</Submit>
<Submit keyname="reset">重置</Submit>

<Username panel="signup" label="邮箱" placeholder="E-mail" keyname="e-mail" />
<Password panel="signup" label="密码" placeholder="请输入密码" keyname="password" />
<Password panel="signup" label="确认密码" placeholder="请输入确认密码" keyname="confirm-password" />
<Submit panel="signup" keyname="signup-submit">
注册
</Submit>
<Submit panel="signup" keyname="signup-reset">
重置
</Submit>
</LoginPage>
</div>
);

export default Demo;
```

## Hide Controls

Use `visible={false}` to hide controls.

```jsx mdx:preview
import React from 'react';
import LoginPage, { Reset, Logo, Password, Footer } from '@react-login-page/page8';
import LoginLogo from 'react-login-page/logo-rect';

const Demo = () => (
<LoginPage style={{ height: 690 }}>
<Logo>
<LoginLogo />
</Logo>
<Password panel="signup" visible={false} keyname="confirm-password" />
<Password visible={false} />
<Footer>
Not a member? <a href="#">Sign up now</a>
</Footer>
</LoginPage>
);

export default Demo;
```
## Add Controls
```jsx mdx:preview
import React from 'react';
import LoginPage, { Reset, Logo, Footer, Username, Password, Input } from '@react-login-page/page8';
import LoginLogo from 'react-login-page/logo-rect';

const imgSrc =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAYAAADDhn8LAAAMuElEQVR42u2d+XMUxxXH/Se4KpVK4h9SqUpSyU+plA/iOITYFRKnSEjZsQuDDARsHBMC2OG+rxCEQQYjc1tYRsgSiFMcEuKSkJDQgUCAECAJdiWZFatbQrd2t6M3zordUb+enp3Z2UPvW/UKSprpbpv3menX/V7PM4xEIqF6hv4XkEgECIlEgJBIBAiJRICQSAQIiUSAkEgECIlEgJBIBAiJRCJASCQChEQiQEgkAoREIkBIJAKERCJASCQChEQiQEgkXF9vuTzMCBASgSGAIdpAIUBIuuEw8zoChDTi4IgmSAgQUlCdPdIhIUBIQXfySIaEACFZ4uCRCgkBQrLEsQkQEgFCgJAIkOiE5MahxVwjQEiWOXQ4AuIFgd4gJAKEAwdNsUhh5dDhAokMHAQIyXJHJkBIBEiYAyILBwGiIWeDkx1NP8qWrV3OJk6bxH4zdjQb9eqvFIO/T5j6Dlu6eilLPZzKHPUOAiQCANEDhx8gn/+xls1/tpJrR+c5gz7wqt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nxWq4NwsQHz/DCdAQPszc4RLvzIWl3pSmVb5KhSAYLvdfuW1Ay5jD3OkDBfbpTcNkPKMzrALzo06rS8U4QoIyOZwsuV7U3WDsnDnAVZZx0/4CwUgWNbuUHnt6gOm9ON7MBzPYNfddEAOzcYPhMtPaGORqEAACaUgfkjPK2FrE9OUYHvsx+uUnXEw+Dv8DH4H2boNre2MpC1TANGqOYffx4x61s8IENKIAUSU1g4FUzwgIgESAoRkCiCQnYsB8vdfvILeF+6QECAkw4DA6hQGR9wrNUIIIgkQgoQACUiJkx0oIHDcjxYE4QoJDwYChADRJVEe1tLnqtm7L/5Asw0ChBS1gMDXaDFATq5olHb+cISEACEZAkSU5g5LvlOe/5l0WwQIKeIBgXyrNscAK0lpFx7G4P00mx6nJ0BIEQeIniIo9WfZ4DPPBAiJAOFYUVK7bqcnQEgjApCkaY6AHT7cICFASKYCAgfJeb94S4CQCBCfA6vV2boECCnqAYESWZ5Bdi6kkCTPqFdKbV19HlOcnQAhRRQgRkSAkAgQAoREgBAgBAgBQoAQICQChAAhESAECIkAIUBIBAgBQgoD/Q8QZpUThrhrWAAAAABJRU5ErkJggg==';

const Demo = () => {
const [data, setData] = React.useState({});
const handle = (even) => {
even.preventDefault();
const formData = new FormData(even.target);
const data = Object.fromEntries(formData);
setData({ ...data });
};
return (
<form onSubmit={handle}>
<LoginPage style={{ height: 990 }}>
<Logo>
<LoginLogo />
</Logo>
<Username keyname="subtitle" visible={false} index={0}>
欢迎登录页面
</Username>
{/* hide default username field */}
<Username visible={false} />
<Username keyname="fields" index={3} label="字段" placeholder="修改了 name 字段" />
<Username keyname="code" index={2} label="验证码">
<img src={imgSrc} height={38} />
</Username>
<Username keyname="username_rule" visible={false} index={4}>
用户名规则
</Username>
<Password index={1} />
<Input name="phone" index={2} placeholder="Phone number">
<img src={imgSrc} height={38} />
</Input>
<Footer>
Not a member? <a href="#">Sign up now</a>
</Footer>
</LoginPage>
<pre>{JSON.stringify(data, null, 2)}</pre>
</form>
);
};

export default Demo;
```
## Modify default control `name`
Modify the string that specifies the **`name`** of the input control by default
1. remove default `name=username` controls
```jsx
<Username visible={false} />
```
2. add `name=user` controls
```jsx
<Username keyname="user" index={3} placeholder="修改了 name 字段" />
```
## Modify Color Style
```jsx mdx:preview
import React from 'react';
import Login from '@react-login-page/page8';

const css = {
'--login-bg': '#5941a2',
'--login-color': '#fff',
'--login-label': '#a1b4b4',
'--login-tab': '#999',
'--login-input': '#3b4465',
'--login-input-bg': '#eef9fe',
'--login-input-placeholder': '#cecece',
'--login-input-placeholder-active': '#53e3a6',
'--login-input-border': '#cddbef',
'--login-input-bg-hover': 'rgba(255, 255, 255, 0.4)',
'--login-btn': '#fff',
'--login-btn-bg': '#5941a2',
'--login-btn-focus': 'white',
'--login-btn-hover': '#9579e7',
'--login-btn-active': '#6544ca',
'--login-footer': '#ffffff99',
'--login-animation-start': '#e2d7f1',
'--login-animation-end': '#fff',
};

const Demo = () => <Login style={{ height: 690, ...css }} />;

export default Demo;
```
Use css variables to override default color values
```css
.login-page7 {
--login-bg: #3b4465;
--login-color: #fff;
--login-label: #a1b4b4;
--login-tab: #999;
--login-input: #3b4465;
--login-input-bg: #eef9fe;
--login-input-placeholder: #cecece;
--login-input-placeholder-active: #53e3a6;
--login-input-border: #cddbef;
--login-input-bg-hover: rgba(255, 255, 255, 0.4);
--login-btn: #fff;
--login-btn-bg: #a7e245;
--login-btn-focus: white;
--login-btn-hover: #53e3a6;
--login-btn-active: #1aa97d;
--login-footer: #ffffff99;
--login-animation-start: #d7e7f1;
--login-animation-end: #fff;
}
```
Custom CSS style overrides
```css
.login-page7 section button:focus {
box-shadow: 0 0 0 2px rgba(0, 142, 240, 0.26);
}
.login-page7 section button:hover {
background-color: #0070bd;
}
.login-page7 section button:active {
background-color: #00528a;
}
```
## Light & Dark Theme
```css
[data-color-mode*='dark'] .login-page8,
.login-page8 {
--login-bg: #3b4465;
--login-color: #fff;
--login-label: #a1b4b4;
--login-tab: #999;
--login-input: #3b4465;
--login-input-bg: #eef9fe;
--login-input-placeholder: #cecece;
--login-input-placeholder-active: #53e3a6;
--login-input-border: #cddbef;
--login-input-bg-hover: rgba(255, 255, 255, 0.4);
--login-btn: #fff;
--login-btn-bg: #a7e245;
--login-btn-focus: white;
--login-btn-hover: #53e3a6;
--login-btn-active: #1aa97d;
--login-footer: #ffffff99;
--login-animation-start: #d7e7f1;
--login-animation-end: #fff;
}
[data-color-mode*='light'] .login-page8 {
--login-bg: #3b4465;
--login-color: #fff;
--login-label: #a1b4b4;
--login-tab: #999;
--login-input: #3b4465;
--login-input-bg: #eef9fe;
--login-input-placeholder: #cecece;
--login-input-placeholder-active: #53e3a6;
--login-input-border: #cddbef;
--login-input-bg-hover: rgba(255, 255, 255, 0.4);
--login-btn: #fff;
--login-btn-bg: #a7e245;
--login-btn-focus: white;
--login-btn-hover: #53e3a6;
--login-btn-active: #1aa97d;
--login-footer: #ffffff99;
--login-animation-start: #d7e7f1;
--login-animation-end: #fff;
}
```
## API
Components be provided to modify control properties and perform other related functions.
```jsx
import LoginPage from '@react-login-page/page8';
// buttons
import { Reset, Submit } from '@react-login-page/page8';
// blocks
import { Logo, Title, TitleLogin, TitleSignup, Footer } from '@react-login-page/page8';
// fields
import { Username, Password } from '@react-login-page/page8';
// Basic Components
import { Button, Input } from '@react-login-page/page8';
// or
import { Button, Input } from 'react-login-page';

<LoginPage>
<Password index={2} />
</LoginPage>

<Input name="phone" index={1} placeholder="Phone number">
<img src="..." height={38} />
</Input>

// Define the order of `Password` controls
<Password index={2} />

// Hiding the `Password` control
<Password visible={false} />

// Add footer content
<Footer>
Not a member? <a href="#">Sign up now</a>
</Footer>

// Modify logo image
<Logo>⚛️</Logo>

// Signup Fields
<Username panel="signup" label="E-mail" type="email" placeholder="E-mail" keyname="e-mail" />
<Password panel="signup" label="Password" placeholder="Password" keyname="password" />
<Password panel="signup" label="Confirm Password" placeholder="Confirm Password" keyname="confirm-password" />
<Submit keyname="signup-submit" panel="signup">Signup</Submit>

```
Use [dot notation](https://legacy.reactjs.org/docs/jsx-in-depth.html#using-dot-notation-for-jsx-type) components.
```jsx
import Login from '@react-login-page/page8';

<Login>
<Login.Password index={2} />
</Login>

// Define the order of `Password` controls
<Login.Password index={2} />

// Hiding the `Password` control
<Login.Password visible={false} />

// Add footer content
<Login.Footer>
Not a member? <a href="#">Sign up now</a>
</Login.Footer>

// Modify logo image
<Login.Logo>⚛️</Login.Logo>

// Signup Fields
<Login.Username panel="signup" label="E-mail" type="email" placeholder="E-mail" keyname="e-mail" />
<Login.Password panel="signup" label="Password" placeholder="Password" keyname="password" />
<Login.Password panel="signup" label="Confirm Password" placeholder="Confirm Password" keyname="confirm-password" />
<Login.Submit keyname="signup-submit" panel="signup">Signup</Login.Submit>
```
## Contributors
As always, thanks to our amazing contributors!
<a href="https://github.com/uiwjs/react-login-page/graphs/contributors">
<img src="https://uiwjs.github.io/react-login-page/CONTRIBUTORS.svg" />
</a>
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
## License
Licensed under the MIT License.
Loading

0 comments on commit 2d0d0ec

Please sign in to comment.