Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: clean upWelcome component#11526

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 3 commits intomainfromrefactor-welcome
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
14 changes: 14 additions & 0 deletionssite/src/components/Welcome/Welcome.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Welcome } from "./Welcome";

const meta: Meta<typeof Welcome> = {
title: "components/Welcome",
component: Welcome,
};

export default meta;
type Story = StoryObj<typeof Welcome>;

const Example: Story = {};

export { Example as Welcome };
66 changes: 31 additions & 35 deletionssite/src/components/Welcome/Welcome.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import { type Interpolation, type Theme } from "@emotion/react";
import { type FC, type PropsWithChildren } from "react";
import { useTheme } from "@emotion/react";
import { CoderIcon } from "../Icons/CoderIcon";

const Language = {
Expand All@@ -10,43 +10,39 @@ const Language = {
),
};

export const Welcome: FC<
PropsWithChildren<{ message?: JSX.Element | string }>
> = ({ message = Language.defaultMessage }) => {
const theme = useTheme();

export const Welcome: FC<PropsWithChildren> = ({ children }) => {
return (
<div>
<div
css={{
display: "flex",
justifyContent: "center",
}}
>
<CoderIcon
css={{
color: theme.palette.text.primary,
fontSize: 64,
}}
/>
<div css={styles.container}>
<CoderIcon css={styles.icon} />
</div>
<h1
css={{
textAlign: "center",
fontSize: 32,
fontWeight: 400,
margin: 0,
marginTop: 16,
marginBottom: 32,
lineHeight: 1.25,

"& strong": {
fontWeight: 600,
},
}}
>
{message}
</h1>
<h1 css={styles.header}>{children || Language.defaultMessage}</h1>
</div>
);
};

const styles = {
container: {
display: "flex",
justifyContent: "center",
},

icon: (theme) => ({
color: theme.palette.text.primary,
fontSize: 64,
}),

header: {
textAlign: "center",
fontSize: 32,
fontWeight: 400,
margin: 0,
marginTop: 16,
marginBottom: 32,
lineHeight: 1.25,

"& strong": {
fontWeight: 600,
},
},
} satisfies Record<string, Interpolation<Theme>>;
2 changes: 1 addition & 1 deletionsite/src/pages/CliAuthPage/CliAuthPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@ export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {

return (
<SignInLayout>
<Welcome message="Session token" />
<Welcome>Session token</Welcome>

<p
css={{
Expand Down
3 changes: 2 additions & 1 deletionsite/src/pages/ExternalAuthPage/ExternalAuthPage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,8 @@ const ExternalAuthPage: FC = () => {
// show an error there?
return (
<SignInLayout>
<Welcome message="Failed to validate oauth access token" />
<Welcome>Failed to validate oauth access token</Welcome>

<p css={{ textAlign: "center" }}>
Attempted to validate the user&apos;s oauth access token from the
authentication flow. This situation may occur as a result of an
Expand Down
9 changes: 5 additions & 4 deletionssite/src/pages/ExternalAuthPage/ExternalAuthPageView.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,7 +33,7 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
if (!externalAuth.authenticated) {
return (
<SignInLayout>
<Welcome message={`Authenticate with${externalAuth.display_name}`} />
<Welcome>Authenticate with {externalAuth.display_name}</Welcome>

{externalAuth.device && (
<GitDeviceAuth
Expand DownExpand Up@@ -63,9 +63,10 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({

return (
<SignInLayout>
<Welcome
message={`You've authenticated with ${externalAuth.display_name}!`}
/>
<Welcome>
You&apos;ve authenticated with {externalAuth.display_name}!
</Welcome>

<p css={styles.text}>
{externalAuth.user?.login && `Hey @${externalAuth.user?.login}! 👋 `}
{(!externalAuth.app_installable ||
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp