Skip to content

Commit

Permalink
Merge pull request #223 from yaob421123/master
Browse files Browse the repository at this point in the history
fix: ProForm组件排版及Login组件文档修改
  • Loading branch information
ChenlingasMx committed Apr 27, 2023
2 parents c0e8dc7 + 5bf42fa commit cabc923
Show file tree
Hide file tree
Showing 11 changed files with 369 additions and 20 deletions.
9 changes: 9 additions & 0 deletions examples/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
"@uiw/react-github-corners": "1.5.3",
"@uiw/react-loader": "4.9.7",
"@uiw/react-markdown-preview": "4.1.10",
"react-login-page": "^0.4.4",
"@react-login-page/base": "^0.4.4",
"@react-login-page/page1": "^0.4.4",
"@react-login-page/page2": "^0.4.4",
"@react-login-page/page3": "^0.4.4",
"@react-login-page/page4": "^0.4.4",
"@react-login-page/page5": "^0.4.4",
"@react-login-page/page6": "^0.4.4",
"@react-login-page/page7": "^0.4.4",
"@uiw/reset.css": "1.0.5",
"@wcj/dark-mode": "^1.0.15",
"markdown-react-code-preview-loader": "2.1.5",
Expand Down
15 changes: 15 additions & 0 deletions examples/website/src/components/Layouts/index/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
import { Outlet, KktproPageProps } from '@kkt/pro';
import Menu from '../Menu';
import Navbar from '../Navbar';
import { createGlobalStyle } from 'styled-components';
import { Wrapper, Main, Body } from './style';
import '@wcj/dark-mode';

export const GlobalStyle = createGlobalStyle`
[data-color-mode*='dark'], [data-color-mode*='dark'] body {
--gradient-from: #1c1e20;
--gradient-to: #0d1117;
--color-rgb: 255 255 255;
}
[data-color-mode*='light'], [data-color-mode*='light'] body {
--gradient-from: #e5eaf0;
--gradient-to: #fff;
--color-rgb: 0 0 0;
}
`;

export default function Layout(props: KktproPageProps) {
return (
<Wrapper className="wmde-markdown-var">
<GlobalStyle />
<Navbar />
<Main>
<Body>
Expand Down
100 changes: 100 additions & 0 deletions examples/website/src/pages/user-login/Example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import styled, { css } from 'styled-components';
import { Link } from '@kkt/pro';
import UserLogin from '@uiw-admin/user-login';
import * as datas from './Examples';

const Wrapper = styled.div`
display: flex;
justify-content: center;
margin: 0 auto;
flex-wrap: wrap;
gap: 0.953rem;
`;

const Title = styled.div`
width: auto !important;
height: auto !important;
position: absolute;
transform: scale(1) !important;
background-color: rgba(var(--color-rgb) / 39%);
color: var(--color-canvas-default);
border-radius: 5px;
padding: 1px 4px 3px 4px;
top: -25px;
left: 10px;
transition: all 0.3s;
`;

const Inner = styled(Link)<{ magnify?: number }>`
overflow: hidden;
display: block;
position: relative;
width: 326px;
height: 265px;
border-radius: 0.571rem;
text-decoration: none;
box-shadow: 0 0px 3px transparent;
border: 1px solid transparent;
transition: all 0.3s;
&::before {
content: '';
display: block;
position: absolute;
background-color: transparent;
transition: all 0.3s;
z-index: 2;
inset: 0;
}
&:hover {
box-shadow: 0 0px 3px rgba(0, 0, 0, 0.1);
border-color: rgb(0 0 0 / 11%);
}
&:hover ${Title} {
top: 10px;
}
&:hover::before {
background-color: var(--color-neutral-muted);
}
& > * {
transform-origin: top left;
${({ magnify = 2 }) => css`
transform: scale(${326 / (326 * magnify)});
width: ${326 * magnify}px;
height: ${265 * magnify}px;
`}
}
`;

const defulat = {
magnify: 2.3,
children: <UserLogin api="/api/login" />,
};

export const Example = () => {
return (
<Wrapper>
<Inner
target="_blank"
to={`https://github.com/uiwjs/uiw-admin/blob/master/packages/user-login/README.md`}
magnify={defulat.magnify}
>
{defulat.children}
<Title>defulat</Title>
</Inner>
{Object.keys(datas).map((path, key) => {
const comps = datas[path as keyof typeof datas];
return (
<Inner
target="_blank"
key={key}
to={`https://uiwjs.github.io/react-login-page/#/pages/${path}`}
magnify={comps.magnify}
>
{comps.children}
<Title>{path}</Title>
</Inner>
);
})}
</Wrapper>
);
};
109 changes: 109 additions & 0 deletions examples/website/src/pages/user-login/Examples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import LoginBase from '@react-login-page/base';
import LoginLogo from 'react-login-page/logo-rect';
import LoginPage1 from '@react-login-page/page1';
import LoginPage2 from '@react-login-page/page2';
// import bannerImage from '@react-login-page/page2/banner-image';
import LoginPage3 from '@react-login-page/page3';
// import bannerImage3 from '@react-login-page/page3/banner-image';
import Login4 from '@react-login-page/page4';
import Login5 from '@react-login-page/page5';
import Login6 from '@react-login-page/page6';
import Login7 from '@react-login-page/page7';

const bannerImage = require('@react-login-page/page2/banner-image');
const bannerImage3 = require('@react-login-page/page3/banner-image');

interface Example {
magnify?: number;
children?: JSX.Element;
}

export const base: Example = {
magnify: 1.3,
children: (
<LoginBase>
<LoginBase.Logo>
<LoginLogo />
</LoginBase.Logo>
</LoginBase>
),
};

export const page1: Example = {
children: (
<LoginPage1>
<LoginPage1.Logo>
<LoginLogo />
</LoginPage1.Logo>
</LoginPage1>
),
};

export const page2: Example = {
magnify: 3.3,
children: (
<LoginPage2>
<LoginPage2.Banner>
<img src={bannerImage} alt="banner" />
</LoginPage2.Banner>
<LoginPage2.Logo>
<LoginLogo />
</LoginPage2.Logo>
</LoginPage2>
),
};

export const page3: Example = {
children: (
<LoginPage3>
<LoginPage3.Banner style={{ backgroundImage: `url(${bannerImage3})` }} />
<LoginPage3.Logo>
<LoginLogo />
</LoginPage3.Logo>
</LoginPage3>
),
};

export const page4: Example = {
magnify: 2.3,
children: (
<Login4>
<Login4.Logo>
<LoginLogo />
</Login4.Logo>
</Login4>
),
};

export const page5: Example = {
magnify: 1.6,
children: (
<Login5>
<Login5.Logo>
<LoginLogo />
</Login5.Logo>
</Login5>
),
};

export const page6: Example = {
magnify: 2.1,
children: (
<Login6>
<Login6.Logo>
<LoginLogo />
</Login6.Logo>
</Login6>
),
};

export const page7: Example = {
magnify: 1.2,
children: (
<Login7>
<Login7.Logo>
<LoginLogo />
</Login7.Logo>
</Login7>
),
};
100 changes: 95 additions & 5 deletions examples/website/src/pages/user-login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,97 @@
import Preview from '../../components/Preview';
import styled from 'styled-components';
import { Link } from '@kkt/pro';
import { ReactComponent as LogoIcon } from './logo-large.svg';
import { Example } from './Example';

const Page = () => (
<Preview path={() => import('@uiw-admin/user-login/README.md')} />
);
const Wrapper = styled.div`
width: 100%;
position: relative;
z-index: 9;
padding-bottom: 60px;
`;

export default Page;
const Title = styled.h1`
font-size: 1.6rem;
font-weight: 900;
line-height: 2.5rem;
text-align: center;
margin-top: 3rem;
margin-bottom: 0;
`;
const SubTitle = styled.h2`
color: var(--color-fg-subtle);
font-size: 1.5rem;
font-weight: normal;
line-height: 2rem;
text-align: center;
max-width: 36rem;
margin: 0.75rem auto 2rem auto;
`;

const Logo = styled(LogoIcon)`
margin: 60px auto;
display: block;
`;

const Nav = styled.nav`
text-align: center;
margin-bottom: 3rem;
gap: 0.845rem;
display: flex;
justify-content: center;
a {
padding: 0.63rem 1.1rem;
font-weight: 700;
background: var(--color-neutral-muted);
border-radius: 0.3rem;
transition: all 0.3s;
text-decoration: none;
&:hover {
background: var(--color-canvas-subtle);
}
}
`;

const Header = styled.div``;
const VersionInfo = styled.sup`
text-align: center;
color: var(--color-fg-subtle);
position: absolute;
font-size: 12px;
font-weight: normal;
margin-left: 10px;
line-height: 12px;
`;

// const version = VERSION;

const Home = () => {
return (
<Wrapper>
<Header>
<Logo height="4rem" />
</Header>
<Title>
React Login Page
{/* <VersionInfo>v{version}</VersionInfo> */}
</Title>
<SubTitle>
Install and use react login page components quickly and easily, with
flexible APIs for modifying these components.
</SubTitle>
<Nav>
<Link to="/docs">Documentation</Link>
<a
href="https://github.com/uiwjs/react-login-page"
target="_blank"
rel="noreferrer"
>
Github
</a>
</Nav>
<Example />
</Wrapper>
);
};

export default Home;
13 changes: 13 additions & 0 deletions examples/website/src/pages/user-login/index2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Preview from '../../components/Preview';

const Page = () => (
<Preview
path={() =>
import(
'https://github.com/uiwjs/react-login-page/edit/main/core/README.md'
)
}
/>
);

export default Page;
7 changes: 7 additions & 0 deletions examples/website/src/pages/user-login/logo-large.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion examples/website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"moduleResolution": "node",
"isolatedModules": true,
"types": ["jest", "node"],
"noEmit": true,
"noEmit": false,
"outDir": "cjs",
"paths": {
"@/*": ["./src/*"],
"@@/*": ["./src/.kktp/*"],
Expand Down

0 comments on commit cabc923

Please sign in to comment.