Skip to content

Commit 37fe717

Browse files
authored
FUI - Moving to the native elements - Sign in and Product pages (#2702)
1 parent 897b84d commit 37fe717

File tree

9 files changed

+46
-31
lines changed

9 files changed

+46
-31
lines changed

src/components/operations/operation-details/react/runtime/operation-console/ConsoleAuthorization.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ export const ConsoleAuthorization = ({
5454
const [selectedAuthorizationFlow, setSelectedAuthorizationFlow] = useState<string>(noAuthFlow);
5555
const [selectedSubscriptionKey, setSelectedSubscriptionKey] = useState<{ name: string, value: string }>(
5656
subscriptionKey
57-
? products.flatMap(p => p.subscriptionKeys).find(k => k.value === subscriptionKey)
57+
? products?.flatMap(p => p.subscriptionKeys).find(k => k.value === subscriptionKey)
5858
: products?.[0]?.subscriptionKeys[0] ?? null
5959
);
6060
const [username, setUsername] = useState<string>("");
6161
const [password, setPassword] = useState<string>("");
6262

6363
const renderAuthorization = () => (
6464
<>
65-
{authorizationServers.length > 0 && selectedAuthorizationServer &&
65+
{authorizationServers?.length > 0 && selectedAuthorizationServer &&
6666
<>
6767
<Stack className="auth-detail">
6868
<Label htmlFor="auth-servers-dropdown">Authorization server</Label>
@@ -108,7 +108,7 @@ export const ConsoleAuthorization = ({
108108
type="text"
109109
placeholder="Enter username"
110110
value={username}
111-
onChange={(VARIABLE_DEFINITION, data) => setUsername(data.value)}
111+
onChange={(_, data) => setUsername(data.value)}
112112
/>
113113
</Stack>
114114
<Stack className="auth-detail" styles={{ root: { marginBottom: 24 } }}>
@@ -129,7 +129,7 @@ export const ConsoleAuthorization = ({
129129
</>
130130
}
131131
{subscriptionRequired && (
132-
(products.length > 0 && selectedSubscriptionKey)
132+
(products?.length > 0 && selectedSubscriptionKey)
133133
? <Stack className="auth-detail">
134134
<Label htmlFor="subscription-key-dropdown">Subscription key</Label>
135135
<Dropdown

src/components/products/product-details/react/ProductDetailsRuntime.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { useEffect, useState } from "react";
33
import { Stack } from "@fluentui/react";
4-
import { Body1, Caption1, FluentProvider, Spinner, Title1 } from "@fluentui/react-components";
4+
import { FluentProvider, Spinner } from "@fluentui/react-components";
55
import { CircleSmallFilled } from "@fluentui/react-icons";
66
import { Resolve } from "@paperbits/react/decorators";
77
import { Router } from "@paperbits/common/routing";
@@ -67,14 +67,12 @@ const ProductDetailsRuntimeFC = ({ usersService, productService, productName }:
6767

6868
return (
6969
<Stack tokens={{ childrenGap: 20 }}>
70-
<Title1>{product.displayName}</Title1>
70+
<h1>{product.displayName}</h1>
7171

72-
<Caption1 block>
73-
Product {!!product.state && <><CircleSmallFilled /> {productStateToLabel(product.state)}</>}
74-
</Caption1>
72+
<h6> Product {!!product.state && <><CircleSmallFilled /> {productStateToLabel(product.state)}</>}</h6>
7573

7674
{product.description &&
77-
<Body1 block><MarkdownProcessor markdownToDisplay={product.description} /></Body1>
75+
<span><MarkdownProcessor markdownToDisplay={product.description} /></span>
7876
}
7977
</Stack>
8078
);

src/components/products/product-subscribe/react/ProductSubscribeForm.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ export const ProductSubscribeForm = ({ subscribe, termsOfUse, showTermsByDefault
2626
horizontal
2727
verticalAlign={"center"}
2828
tokens={{ childrenGap: 15 }}
29+
className="form-group"
2930
>
3031
<Stack.Item>
31-
<Input
32+
<input
3233
value={subscriptionName}
33-
onChange={(_, data) => setSubscriptionName(data.value)}
34+
onChange={(event) => setSubscriptionName(event.target.value)}
3435
placeholder={"Your new product subscription name"}
36+
className="form-control"
3537
style={{ width: "20em" }}
3638
/>
3739
</Stack.Item>
3840
<Stack.Item>
3941
<BtnSpinner
4042
onClick={() => subscribe(subscriptionName, consented)}
41-
appearance="primary"
43+
className="button button-primary"
4244
disabled={!subscriptionName || (termsOfUse && !consented)}
4345
>
4446
Subscribe

src/components/products/product-subscribe/react/ProductSubscribeRuntime.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
22
import { useCallback, useEffect, useState } from "react";
3-
import { Body1Strong, FluentProvider, Spinner } from "@fluentui/react-components";
3+
import { FluentProvider, Spinner } from "@fluentui/react-components";
44
import { Resolve } from "@paperbits/react/decorators";
55
import { Router } from "@paperbits/common/routing";
66
import * as Constants from "../../../../constants";
@@ -117,7 +117,7 @@ const ProductSubscribeRuntimeFC = ({ backendService, usersService, tenantService
117117
}, [backendService, productService, productName, userId, isDelegationEnabled, hasToS]);
118118

119119
if (working) return <Spinner size="extra-tiny" label={"Loading data"} labelPosition={"after"} />;
120-
if (isLimitReached) return <Body1Strong style={{ display: "block", padding: "1rem 0" }}>You've reached maximum number of subscriptions.</Body1Strong>;
120+
if (isLimitReached) return <span className="strong" style={{ display: "block", padding: "1rem 0" }}>You've reached maximum number of subscriptions.</span>;
121121

122122
return <ProductSubscribeForm subscribe={subscribe} termsOfUse={product?.terms} showTermsByDefault={showTermsByDefault} />;
123123
};

src/components/users/signin/react/SignInForm.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,27 @@ export const SignInForm = ({
6969
return (
7070
<Stack tokens={{ childrenGap: 20, maxWidth: 435 }}>
7171
<Stack.Item>
72-
<Stack>
73-
<Label required htmlFor="email">
74-
Email address
75-
</Label>
76-
<Input
72+
<Stack className="form-group">
73+
<label htmlFor="email">Email address</label>
74+
<input
7775
id="email"
7876
placeholder="Enter email address"
7977
type="email"
78+
className="form-control"
8079
value={email}
8180
onChange={(event) => setEmail(event.target.value)}
8281
/>
8382
</Stack>
8483
</Stack.Item>
8584

8685
<Stack.Item>
87-
<Stack>
88-
<Label required htmlFor="password">
89-
Password
90-
</Label>
91-
<Input
86+
<Stack className="form-group">
87+
<label htmlFor="password">Password</label>
88+
<input
9289
id="password"
9390
placeholder="Enter password"
9491
type="password"
92+
className="form-control"
9593
value={password}
9694
onChange={(event) => setPassword(event.target.value)}
9795
/>
@@ -100,9 +98,9 @@ export const SignInForm = ({
10098

10199
<Stack.Item>
102100
<BtnSpinner
103-
appearance="primary"
104101
onClick={submit}
105102
disabled={!email || !password}
103+
className="button button-primary"
106104
>
107105
Sign in
108106
</BtnSpinner>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
import * as React from "react";
22
import { useState } from "react";
3-
import { Button, ButtonProps, Spinner } from "@fluentui/react-components";
3+
import { ButtonProps, Spinner } from "@fluentui/react-components";
44

55
export type TProps = ButtonProps & {
66
onClick: () => Promise<unknown>;
77
working?: boolean;
8+
className?: string;
89
};
910

1011
export const BtnSpinner = ({
1112
children,
1213
onClick,
1314
disabled,
1415
working: workingProp,
15-
...props
16+
className
1617
}: TProps) => {
1718
const [working, setWorking] = useState(false);
1819

1920
return (
20-
<Button
21-
{...props}
21+
<button
2222
disabled={disabled || working || workingProp}
2323
onClick={() => {
2424
setWorking(true);
2525
onClick().finally(() => setWorking(false));
2626
}}
27+
className={className}
2728
>
2829
{(working || workingProp) && <Spinner size={"extra-tiny"} style={{ marginRight: ".5rem" }} />}
2930
{children}
30-
</Button>
31+
</button>
3132
);
3233
};

src/themes/website/styles/buttons.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
.button {
2+
display: flex;
3+
align-items: center;
4+
justify-content: center;
5+
6+
&:disabled {
7+
pointer-events: none;
8+
}
9+
210
&.button-noborder {
311
border: none;
412
background: transparent;

src/themes/website/styles/forms.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ input[type="range"] {
109109
}
110110
}
111111

112+
input:focus-visible {
113+
outline: none;
114+
}
115+
112116
input[type=search] {
113117
white-space: nowrap;
114118
overflow: hidden;

src/themes/website/styles/text.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ h6 {
1212
pre {
1313
white-space: pre-wrap;
1414
}
15+
16+
span.strong {
17+
font-weight: 600;
18+
}

0 commit comments

Comments
 (0)