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

Commit8a48485

Browse files
authored
refactor: clean upWelcome component (#11526)
1 parent4fa0712 commit8a48485

File tree

5 files changed

+53
-41
lines changed

5 files changed

+53
-41
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
importtype{Meta,StoryObj}from"@storybook/react";
2+
import{Welcome}from"./Welcome";
3+
4+
constmeta:Meta<typeofWelcome>={
5+
title:"components/Welcome",
6+
component:Welcome,
7+
};
8+
9+
exportdefaultmeta;
10+
typeStory=StoryObj<typeofWelcome>;
11+
12+
constExample:Story={};
13+
14+
export{ExampleasWelcome};
Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import{typeInterpolation,typeTheme}from"@emotion/react";
12
import{typeFC,typePropsWithChildren}from"react";
2-
import{useTheme}from"@emotion/react";
33
import{CoderIcon}from"../Icons/CoderIcon";
44

55
constLanguage={
@@ -10,43 +10,39 @@ const Language = {
1010
),
1111
};
1212

13-
exportconstWelcome:FC<
14-
PropsWithChildren<{message?:JSX.Element|string}>
15-
>=({ message=Language.defaultMessage})=>{
16-
consttheme=useTheme();
17-
13+
exportconstWelcome:FC<PropsWithChildren>=({ children})=>{
1814
return(
1915
<div>
20-
<div
21-
css={{
22-
display:"flex",
23-
justifyContent:"center",
24-
}}
25-
>
26-
<CoderIcon
27-
css={{
28-
color:theme.palette.text.primary,
29-
fontSize:64,
30-
}}
31-
/>
16+
<divcss={styles.container}>
17+
<CoderIconcss={styles.icon}/>
3218
</div>
33-
<h1
34-
css={{
35-
textAlign:"center",
36-
fontSize:32,
37-
fontWeight:400,
38-
margin:0,
39-
marginTop:16,
40-
marginBottom:32,
41-
lineHeight:1.25,
42-
43-
"& strong":{
44-
fontWeight:600,
45-
},
46-
}}
47-
>
48-
{message}
49-
</h1>
19+
<h1css={styles.header}>{children||Language.defaultMessage}</h1>
5020
</div>
5121
);
5222
};
23+
24+
conststyles={
25+
container:{
26+
display:"flex",
27+
justifyContent:"center",
28+
},
29+
30+
icon:(theme)=>({
31+
color:theme.palette.text.primary,
32+
fontSize:64,
33+
}),
34+
35+
header:{
36+
textAlign:"center",
37+
fontSize:32,
38+
fontWeight:400,
39+
margin:0,
40+
marginTop:16,
41+
marginBottom:32,
42+
lineHeight:1.25,
43+
44+
"& strong":{
45+
fontWeight:600,
46+
},
47+
},
48+
}satisfiesRecord<string,Interpolation<Theme>>;

‎site/src/pages/CliAuthPage/CliAuthPageView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {
2020

2121
return(
2222
<SignInLayout>
23-
<Welcomemessage="Session token"/>
23+
<Welcome>Session token</Welcome>
2424

2525
<p
2626
css={{

‎site/src/pages/ExternalAuthPage/ExternalAuthPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ const ExternalAuthPage: FC = () => {
6969
// show an error there?
7070
return(
7171
<SignInLayout>
72-
<Welcomemessage="Failed to validate oauth access token"/>
72+
<Welcome>Failed to validate oauth access token</Welcome>
73+
7374
<pcss={{textAlign:"center"}}>
7475
Attempted to validate the user&apos;s oauth access token from the
7576
authentication flow. This situation may occur as a result of an

‎site/src/pages/ExternalAuthPage/ExternalAuthPageView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
3333
if(!externalAuth.authenticated){
3434
return(
3535
<SignInLayout>
36-
<Welcomemessage={`Authenticate with${externalAuth.display_name}`}/>
36+
<Welcome>Authenticate with{externalAuth.display_name}</Welcome>
3737

3838
{externalAuth.device&&(
3939
<GitDeviceAuth
@@ -63,9 +63,10 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
6363

6464
return(
6565
<SignInLayout>
66-
<Welcome
67-
message={`You've authenticated with${externalAuth.display_name}!`}
68-
/>
66+
<Welcome>
67+
You&apos;ve authenticated with{externalAuth.display_name}!
68+
</Welcome>
69+
6970
<pcss={styles.text}>
7071
{externalAuth.user?.login&&`Hey @${externalAuth.user?.login}! 👋 `}
7172
{(!externalAuth.app_installable||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp