@react-login-page/page2
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@react-login-page/page2

Buy me a coffee npm version Downloads

login-page

Install

$ npm install @react-login-page/page2 --save

Usage

import React from 'react';
import Login from '@react-login-page/page2';
import defaultBannerImage from '@react-login-page/page2/banner-image';

const Demo = () => (
  <Login style={{ height: 580 }}>
    <Login.Banner>
      <img src={defaultBannerImage} />
    </Login.Banner>
    <Login.Password>
      <div>xx</div>
    </Login.Password>
  </Login>
);

export default Demo;

Modify Controls

import React from 'react';
import LoginPage, { Email, Password, Submit, Title, Logo, Reset } from '@react-login-page/page2';
import defaultBannerImage from '@react-login-page/page2/banner-image';
import LoginLogo from 'react-login-page/logo';

const styles = { height: 580 };

const Demo = () => (
  <div style={styles}>
    <LoginPage>
      <LoginPage.Banner>
        <img src={defaultBannerImage} />
      </LoginPage.Banner>
      <Email name="userUserName" />
      <Password placeholder="请输入密码" name="userPassword" />
      <Submit>提交</Submit>
      <Reset disabled>重置</Reset>
      <Title visible={false} />
      <Logo>
        <LoginLogo />
      </Logo>
    </LoginPage>
  </div>
);

export default Demo;

Hide Controls

Use visible={false} to hide controls.

import React from 'react';
import LoginPage, { Reset, Title, Logo, Banner, Password } from '@react-login-page/page2';
import LoginLogo from 'react-login-page/logo-rect';
import defaultBannerImage from '@react-login-page/page2/banner-image';

const Demo = () => (
  <LoginPage style={{ height: 580 }}>
    <Logo>
      <LoginLogo />
    </Logo>
    <Title />
    <Password visible={false} />
    <Banner>
      <img src={defaultBannerImage} />
    </Banner>
  </LoginPage>
);

export default Demo;

Add content after the button

import React from 'react';
import LoginPage, { Reset, Logo, Email, Banner, ButtonAfter, Password, Input } from '@react-login-page/page2';
import LoginLogo from 'react-login-page/logo-rect';
import defaultBannerImage from '@react-login-page/page2/banner-image';

const Demo = () => (
  <LoginPage style={{ height: 580 }}>
    <Logo>
      <LoginLogo />
    </Logo>
    <Email index={3} type="text" placeholder="Username" />
    <Password index={2} />
    <Input name="phone" index={1} placeholder="Phone number">
      <div>xx</div>
    </Input>
    <Banner>
      <img src={defaultBannerImage} />
    </Banner>
    <ButtonAfter>
      Forgot <a href="#">Username / Password?</a>
    </ButtonAfter>
  </LoginPage>
);

export default Demo;

Modify Color Style

import React from 'react';
import Login from '@react-login-page/page2';

const css = {
  '--login-bg': 'linear-gradient(-135deg,#c850c0,#4158d0)',
  '--login-color': '#333',
  '--login-inner-bg': '#fff',
  '--login-input': '#57b846',
  '--login-input-bg': '#e6e6e6',
  '--login-input-placeholder': '#999999',
  '--login-btn': '#fff',
  '--login-btn-bg': '#57b846',
  '--login-btn-bg-focus': '#57b846',
  '--login-btn-bg-hover': '#333',
  '--login-btn-bg-active': '#57b846',
};

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

export default Demo;

Use css variables to override default color values

.login-page2 {
  --login-bg: linear-gradient(-135deg, #c850c0, #4158d0);
  --login-color: #333;
  --login-inner-bg: #fff;
  --login-input: #57b846;
  --login-input-bg: #e6e6e6;
  --login-input-placeholder: #999999;
  --login-btn: #fff;
  --login-btn-bg: #57b846;
  --login-btn-bg-focus: #57b846;
  --login-btn-bg-hover: #333;
  --login-btn-bg-active: #57b846;
}

Custom CSS style overrides

.login-page2 section button:focus {
  box-shadow: 0 0 0 2px rgba(0, 142, 240, 0.26);
}
.login-page2 section button:hover {
  background-color: #0070bd;
}
.login-page2 section button:active {
  background-color: #00528a;
}

Light & Dark Theme

[data-color-mode*='dark'] .login-page2,
.login-page2 {
  --login-bg: linear-gradient(-135deg, #c850c0, #4158d0);
  --login-color: #333;
  --login-inner-bg: #fff;
  --login-input: #666;
  --login-input-bg: #e6e6e6;
  --login-input-placeholder: #999999;
  --login-btn: #fff;
  --login-btn-bg: #57b846;
  --login-btn-bg-focus: #57b846;
  --login-btn-bg-hover: #333;
  --login-btn-bg-active: #57b846;
}
[data-color-mode*='light'] .login-page2 {
  --login-bg: linear-gradient(-135deg, #c850c0, #4158d0);
  --login-color: #333;
  --login-inner-bg: #fff;
  --login-input: #57b846;
  --login-input-bg: #e6e6e6;
  --login-input-placeholder: #999999;
  --login-btn: #fff;
  --login-btn-bg: #57b846;
  --login-btn-bg-focus: #57b846;
  --login-btn-bg-hover: #333;
  --login-btn-bg-active: #57b846;
}

API

Components be provided to modify control properties and perform other related functions.

import LoginPage from '@react-login-page/page2';
// buttons
import { Reset, Submit } from '@react-login-page/page2';
// blocks
import { Logo, Title, ButtonAfter } from '@react-login-page/page2';
// fields
import { Email, Password } from '@react-login-page/page2';

import defaultBannerImage from '@react-login-page/page2/banner-image';

// Basic Components
import { Button, Input } from '@react-login-page/page2';
// or
import { Button, Input } from 'react-login-page';

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

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

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

// Add input control
<Input name="phone" index={1} placeholder="Phone number">
  <svg>...</svg>
</Input>

// Add content after the button
<ButtonAfter>
  Forgot <a href="#">Username / Password?</a>
</ButtonAfter>

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

Use dot notation components.

import Login from '@react-login-page/page2';

<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 content after the button
<Login.ButtonAfter>
  Forgot <a href="#">Username / Password?</a>
</Login.ButtonAfter>

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

Contributors

As always, thanks to our amazing contributors!

Made with contributors.

License

Licensed under the MIT License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.4
15latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.4
15
1.0.3
0
1.0.2
0
1.0.1
0
1.0.00
0.4.160
0.4.150
0.4.140
0.4.130
0.4.120
0.4.110
0.4.101
0.4.91
0.4.80
0.4.70
0.4.60
0.4.50
0.4.40
0.4.30
0.4.20
0.4.10
0.4.00
0.3.70
0.3.60
0.3.50
0.3.40
0.3.30
0.3.20
0.3.10
0.3.00
0.2.10

Package Sidebar

Install

npm i @react-login-page/page2

Weekly Downloads

17

Version

1.0.4

License

MIT

Unpacked Size

92.9 kB

Total Files

70

Last publish

Collaborators

  • uiwjs
  • wcjiang