Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flat-component): add LoginChannel component in LoginPage #596

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export const LoginChannel: React.FC<LoginChannelProps> = ({ onLogin }) => {
<div className="login-channel-container">
<Button onClick={() => onLogin("wechat")} className="login-channel-wechat">
<img src={wechatSVG} />
微信登陆
微信登录
</Button>
<Button onClick={() => onLogin("github")} className="login-channel-github">
<img src={githubSVG} />
GitHub登陆
GitHub登录
</Button>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const LoginContent: React.FC<LoginContentProps> = ({ onLogin }) => {
<div className="qr-code-container">
<div className="qr-code">{inPageLogin}</div>
<a className="qr-code-link" onClick={() => setInPageLogin(void 0)}>
使用其他方式登陆
使用其他方式登录
</a>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import QRCodeSVG from "./icons/qr-code.svg";

import { Meta, Story } from "@storybook/react";
import { Modal } from "antd";
import React from "react";
import { LoginChannelType, LoginPanel, LoginPanelProps } from ".";

const storyMeta: Meta = {
title: "LoginPage/LoginPanel",
component: LoginPanel,
parameters: {
layout: "fullscreen",
viewport: {
viewports: {
desktop: {
name: "Desktop",
styles: { width: "960px", height: "640px" },
},
web: {
name: "Web",
styles: { width: "1440px", height: "674px" },
},
},
defaultViewport: "desktop",
},
options: {
showPanel: false,
},
},
};

export default storyMeta;

const handleLogin = (loginChannel: LoginChannelType): React.ReactElement | undefined => {
switch (loginChannel) {
case "wechat": {
return <img src={QRCodeSVG} />;
}
case "github": {
Modal.info({ content: "This is Github Login" });
return;
}
default: {
return;
}
}
};

export const PlayableExample: Story<LoginPanelProps> = args => (
<div className="vh-100">
<LoginPanel {...args} />
</div>
);
PlayableExample.args = {
onLogin: handleLogin,
};