File tree 5 files changed +53
-41
lines changed
5 files changed +53
-41
lines changed Original file line number Diff line number Diff line change
1
+ import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { Welcome } from "./Welcome" ;
3
+
4
+ const meta : Meta < typeof Welcome > = {
5
+ title : "components/Welcome" ,
6
+ component : Welcome ,
7
+ } ;
8
+
9
+ export default meta ;
10
+ type Story = StoryObj < typeof Welcome > ;
11
+
12
+ const Example : Story = { } ;
13
+
14
+ export { Example as Welcome } ;
Original file line number Diff line number Diff line change
1
+ import { type Interpolation , type Theme } from "@emotion/react" ;
1
2
import { type FC , type PropsWithChildren } from "react" ;
2
- import { useTheme } from "@emotion/react" ;
3
3
import { CoderIcon } from "../Icons/CoderIcon" ;
4
4
5
5
const Language = {
@@ -10,43 +10,39 @@ const Language = {
10
10
) ,
11
11
} ;
12
12
13
- export const Welcome : FC <
14
- PropsWithChildren < { message ?: JSX . Element | string } >
15
- > = ( { message = Language . defaultMessage } ) => {
16
- const theme = useTheme ( ) ;
17
-
13
+ export const Welcome : FC < PropsWithChildren > = ( { children } ) => {
18
14
return (
19
15
< 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
+ < div css = { styles . container } >
17
+ < CoderIcon css = { styles . icon } />
32
18
</ 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
+ < h1 css = { styles . header } > { children || Language . defaultMessage } </ h1 >
50
20
</ div >
51
21
) ;
52
22
} ;
23
+
24
+ const styles = {
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
+ } satisfies Record < string , Interpolation < Theme > > ;
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ export const CliAuthPageView: FC<CliAuthPageViewProps> = ({ sessionToken }) => {
20
20
21
21
return (
22
22
< SignInLayout >
23
- < Welcome message = " Session token" / >
23
+ < Welcome > Session token</ Welcome >
24
24
25
25
< p
26
26
css = { {
Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ const ExternalAuthPage: FC = () => {
69
69
// show an error there?
70
70
return (
71
71
< SignInLayout >
72
- < Welcome message = "Failed to validate oauth access token" />
72
+ < Welcome > Failed to validate oauth access token</ Welcome >
73
+
73
74
< p css = { { textAlign : "center" } } >
74
75
Attempted to validate the user's oauth access token from the
75
76
authentication flow. This situation may occur as a result of an
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
33
33
if ( ! externalAuth . authenticated ) {
34
34
return (
35
35
< SignInLayout >
36
- < Welcome message = { ` Authenticate with $ {externalAuth . display_name } ` } / >
36
+ < Welcome > Authenticate with { externalAuth . display_name } </ Welcome >
37
37
38
38
{ externalAuth . device && (
39
39
< GitDeviceAuth
@@ -63,9 +63,10 @@ const ExternalAuthPageView: FC<ExternalAuthPageViewProps> = ({
63
63
64
64
return (
65
65
< SignInLayout >
66
- < Welcome
67
- message = { `You've authenticated with ${ externalAuth . display_name } !` }
68
- />
66
+ < Welcome >
67
+ You've authenticated with { externalAuth . display_name } !
68
+ </ Welcome >
69
+
69
70
< p css = { styles . text } >
70
71
{ externalAuth . user ?. login && `Hey @${ externalAuth . user ?. login } ! 👋 ` }
71
72
{ ( ! externalAuth . app_installable ||
You can’t perform that action at this time.
0 commit comments