Skip to content

Commit afe564b

Browse files
authored
Update design based on feedback. (#3123)
* Update design based on feedback. * Undo irrelevant changes * Debug build hash * Use style tag instead * Updated based on PR feedback * Updated based on PR feedback * Updated based on PR feedback
1 parent 66c1d24 commit afe564b

27 files changed

+1154
-365
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from "svelte/elements";
3+
import { fly } from "svelte/transition";
4+
import { page, navigating } from "$app/state";
35
46
type Props = HTMLAttributes<HTMLDivElement>;
57
@@ -9,11 +11,23 @@
911
<div
1012
{...props}
1113
class={[
12-
"flex w-full flex-col rounded-xl px-4 pt-5 pb-6",
14+
"grid w-full flex-col overflow-hidden rounded-xl px-4 pt-5 pb-8",
1315
"max-sm:flex-1",
14-
"sm:bg-bg-secondary sm:border-border-secondary sm:max-w-100 sm:border sm:px-6",
16+
"sm:bg-bg-secondary sm:border-border-secondary sm:border sm:px-6",
1517
className,
1618
]}
1719
>
18-
{@render children?.()}
20+
{#if !("disableNavigationAnimation" in page.state)}
21+
{#key page.route.id}
22+
<div
23+
class="col-start-1 row-start-1 flex flex-col max-sm:flex-1"
24+
in:fly={{ x: 200 * (navigating.delta ?? 1), duration: 200, delay: 80 }}
25+
out:fly={{ x: -160 * (navigating.delta ?? 1), duration: 160 }}
26+
>
27+
{@render children?.()}
28+
</div>
29+
{/key}
30+
{:else}
31+
{@render children?.()}
32+
{/if}
1933
</div>

src/frontend/src/lib/components/layout/Footer.svelte

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,23 @@
1414
className,
1515
]}
1616
>
17-
<div class="text-text-tertiary text-sm font-medium">© Internet Identity</div>
18-
<nav class="text-text-primary flex gap-4 text-sm font-semibold">
19-
<a href={SUPPORT_URL} target="_blank" rel="noopener">Support</a>
20-
<a href={SOURCE_CODE_URL} target="_blank" rel="noopener">Source code</a>
17+
<div class="text-text-tertiary text-xs font-medium">© Internet Identity</div>
18+
<nav class="text-text-primary flex gap-4 text-xs font-semibold">
19+
<a
20+
href={SUPPORT_URL}
21+
target="_blank"
22+
rel="noopener"
23+
class="outline-0 focus-visible:underline"
24+
>
25+
Support
26+
</a>
27+
<a
28+
href={SOURCE_CODE_URL}
29+
target="_blank"
30+
rel="noopener"
31+
class="outline-0 focus-visible:underline"
32+
>
33+
Source code
34+
</a>
2135
</nav>
2236
</footer>
Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,92 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from "svelte/elements";
33
import Logo from "$lib/components/ui/Logo.svelte";
4+
import { lastUsedIdentitiesStore } from "$lib/stores/last-used-identities.store";
5+
import { nonNullish } from "@dfinity/utils";
6+
import { ChevronDownIcon } from "@lucide/svelte";
7+
import Button from "$lib/components/ui/Button.svelte";
8+
import Popover from "$lib/components/ui/Popover.svelte";
9+
import { goto } from "$app/navigation";
10+
import Dialog from "$lib/components/ui/Dialog.svelte";
11+
import UseAnotherIdentity from "$lib/components/views/UseAnotherIdentity.svelte";
12+
import IdentitySwitcher from "$lib/components/ui/IdentitySwitcher.svelte";
13+
import { authenticationStore } from "$lib/stores/authentication.store";
414
515
type Props = HTMLAttributes<HTMLHeadElement>;
616
717
const { children, class: className, ...props }: Props = $props();
18+
19+
const lastUsedIdentities = $derived(
20+
Object.values($lastUsedIdentitiesStore.identities)
21+
.sort((a, b) => b.lastUsedTimestampMillis - a.lastUsedTimestampMillis)
22+
.slice(0, 5),
23+
);
24+
const selectedIdentity = $derived($lastUsedIdentitiesStore.selected);
25+
26+
let identityButtonRef = $state<HTMLElement>();
27+
let isIdentityPopoverOpen = $state(false);
28+
let isSignInDialogOpen = $state(false);
829
</script>
930

1031
<header
1132
{...props}
12-
class={["flex h-14 items-center px-4 py-3 md:px-6 lg:px-8", className]}
33+
class={["flex items-center px-3 md:px-6 lg:px-8", className]}
1334
>
1435
<!-- TODO: Revert to anchor tag when we create the landing page -->
15-
<div class="flex h-14 items-center gap-4">
36+
<div class="flex h-16 flex-1 items-center gap-4">
1637
<Logo class="text-fg-primary h-5.5" />
17-
<h1 class="text-md text-text-primary hidden font-semibold md:block">
38+
<h1 class="text-md text-text-primary hidden font-semibold sm:block">
1839
Internet Identity
1940
</h1>
41+
{#if nonNullish(selectedIdentity)}
42+
<Button
43+
bind:element={identityButtonRef}
44+
onclick={() => (isIdentityPopoverOpen = true)}
45+
variant="tertiary"
46+
class="ml-auto gap-2.5 pr-3 md:-mr-3"
47+
>
48+
<span>{selectedIdentity.name ?? selectedIdentity.identityNumber}</span>
49+
<ChevronDownIcon size="1rem" />
50+
</Button>
51+
52+
{#if isIdentityPopoverOpen}
53+
<Popover
54+
anchor={identityButtonRef}
55+
onClose={() => (isIdentityPopoverOpen = false)}
56+
direction="down"
57+
align="end"
58+
distance="0.75rem"
59+
>
60+
<IdentitySwitcher
61+
selected={selectedIdentity.identityNumber}
62+
identities={lastUsedIdentities}
63+
switchIdentity={(identityNumber) => {
64+
authenticationStore.reset();
65+
lastUsedIdentitiesStore.selectIdentity(identityNumber);
66+
isIdentityPopoverOpen = false;
67+
}}
68+
useAnotherIdentity={() => (isSignInDialogOpen = true)}
69+
onClose={() => (isIdentityPopoverOpen = false)}
70+
/>
71+
</Popover>
72+
{/if}
73+
74+
{#if isSignInDialogOpen}
75+
<Dialog onClose={() => (isSignInDialogOpen = false)}>
76+
<UseAnotherIdentity
77+
onCancel={() => (isSignInDialogOpen = false)}
78+
onSuccess={(identityNumber) => {
79+
isSignInDialogOpen = false;
80+
lastUsedIdentitiesStore.selectIdentity(identityNumber);
81+
goto("/authorize/account", {
82+
replaceState: true,
83+
invalidateAll: true,
84+
state: { disableNavigationAnimation: true },
85+
});
86+
}}
87+
/>
88+
</Dialog>
89+
{/if}
90+
{/if}
2091
</div>
2192
</header>

src/frontend/src/lib/components/ui/AuthorizeHeader.svelte

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@
1818
</script>
1919

2020
<div {...props} class={["flex flex-1 flex-col", className]}>
21-
<div
22-
class="flex flex-1 flex-col items-center justify-center pb-3 [@media(min-height:648px)]:py-8"
23-
>
21+
<div class="flex flex-1 flex-col items-center justify-center pt-5 pb-6">
2422
<div
2523
aria-hidden="true"
2624
class={[
27-
"mb-4 flex shrink-0 items-center justify-center overflow-hidden rounded-2xl",
25+
"mb-6 flex shrink-0 items-center justify-center overflow-hidden rounded-2xl",
2826
isNullish(dapp?.logoSrc) &&
2927
"border-border-tertiary text-fg-primary bg-bg-primary border",
3028
]}
@@ -41,13 +39,4 @@
4139
<Ellipsis text={hostname} position="middle" />
4240
</Badge>
4341
</div>
44-
<h1 class="text-text-primary mb-2 self-start text-2xl font-medium">
45-
Sign in
46-
</h1>
47-
<p class="text-text-secondary self-start text-sm">
48-
{#if nonNullish(dapp?.name)}
49-
<span>to <b>{dapp.name}</b></span>
50-
{/if}
51-
<span>with Internet Identity</span>
52-
</p>
5342
</div>

src/frontend/src/lib/components/ui/Avatar.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
<div
1212
{...props}
1313
class={[
14-
"bg-bg-tertiary border-border-secondary text-fg-disabled flex shrink-0 items-center justify-center rounded-full border font-semibold",
14+
"bg-bg-secondary border-border-secondary text-fg-disabled flex shrink-0 items-center justify-center rounded-full border font-semibold",
1515
{
1616
sm: "size-8 text-sm",
1717
md: "size-10 text-sm",
1818
lg: "text-md size-12",
1919
xl: "text-md size-14",
2020
}[size],
21+
className,
2122
]}
2223
>
2324
{@render children?.()}

src/frontend/src/lib/components/ui/Button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
bind:element
3232
{...props}
3333
class={[
34-
"box-border flex items-center justify-center justify-self-start rounded-md font-semibold whitespace-nowrap opacity-100",
34+
"box-border flex cursor-pointer items-center justify-center justify-self-start rounded-md font-semibold whitespace-nowrap opacity-100",
3535
{
3636
primary: [
3737
"bg-bg-brand-solid text-text-primary-inversed",

src/frontend/src/lib/components/ui/RadioCard.svelte renamed to src/frontend/src/lib/components/ui/ButtonCard.svelte

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,26 @@
33
HTMLAnchorAttributes,
44
HTMLButtonAttributes,
55
} from "svelte/elements";
6-
import Checkbox from "$lib/components/ui/Checkbox.svelte";
76
import ButtonOrAnchor from "$lib/components/utils/ButtonOrAnchor.svelte";
87
98
type Props = HTMLButtonAttributes &
109
HTMLAnchorAttributes & {
1110
element?: HTMLElement;
12-
checked?: boolean;
13-
checkIcon?: boolean;
1411
};
1512
1613
let {
1714
children,
1815
element = $bindable(),
1916
class: className,
20-
checked,
21-
checkIcon,
2217
...props
2318
}: Props = $props();
2419
</script>
2520

2621
<ButtonOrAnchor
2722
bind:element
28-
role="radio"
29-
aria-checked={checked}
3023
{...props}
3124
class={[
3225
"bg-bg-primary ring-border-secondary text-text-primary not-disabled:hover:bg-bg-primary_hover relative flex items-center justify-start gap-3 rounded-md p-3 text-sm font-semibold ring-1 outline-none ring-inset not-dark:shadow-xs",
33-
checked && "!ring-border-brand ring-2",
3426
"disabled:ring-border-disabled disabled:text-text-disabled",
3527
className,
3628
]}
@@ -39,13 +31,4 @@
3931
class="in-focus-visible:ring-focus-ring in-focus-visible:ring-offset-bg-primary pointer-events-none absolute inset-0 rounded-md in-focus-visible:ring-2 in-focus-visible:ring-offset-2"
4032
></div>
4133
{@render children?.()}
42-
{#if checked && checkIcon}
43-
<Checkbox
44-
checked
45-
size="md"
46-
class="pointer-events-none mr-1 !rounded-full"
47-
tabindex={-1}
48-
aria-hidden="true"
49-
/>
50-
{/if}
5134
</ButtonOrAnchor>

src/frontend/src/lib/components/ui/Dialog.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
99
type Props = HTMLAttributes<HTMLDialogElement> & {
1010
onClose?: () => void;
11-
title?: string;
1211
closeOnOutsideClick?: boolean;
1312
showCloseButton?: boolean;
1413
backdrop?: boolean;
@@ -17,7 +16,6 @@
1716
const {
1817
children,
1918
onClose,
20-
title,
2119
class: className,
2220
closeOnOutsideClick = true,
2321
showCloseButton = true,
@@ -100,7 +98,7 @@
10098
backdrop && "[&[data-visible]]:backdrop:opacity-80",
10199
]}
102100
style="--keyboard-inset-height: env(keyboard-inset-height);"
103-
transition:transitionFn
101+
transition:transitionFn|global
104102
onoutrostart={fadeOutBackDrop}
105103
{...props}
106104
>

0 commit comments

Comments
 (0)