Skip to content

Commit 320b66c

Browse files
feat(ui): add user profile delete section
1 parent 2ace72a commit 320b66c

6 files changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/swingset/src/components/DocsViewer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const docModules: Record<string, Record<string, React.ComponentType>> = {
1717
() => import('../stories/user-profile-connected-accounts-section.mdx'),
1818
),
1919
'user-profile-web3wallets-section': dynamic(() => import('../stories/user-profile-web3-wallets-section.mdx')),
20+
'user-profile-delete-section': dynamic(() => import('../stories/user-profile-delete-section.mdx')),
2021
},
2122
organization: {
2223
'organization-profile': dynamic(() => import('../stories/organization-profile.mdx')),

packages/swingset/src/lib/registry.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ import {
138138
Default as UserProfileConnectedAccountsSectionDefault,
139139
meta as userProfileConnectedAccountsSectionMeta,
140140
} from '../stories/user-profile-connected-accounts-section.stories';
141+
import {
142+
Default as UserProfileDeleteSectionDefault,
143+
meta as userProfileDeleteSectionMeta,
144+
} from '../stories/user-profile-delete-section.stories';
141145
import {
142146
Default as UserProfileWeb3WalletsSectionDefault,
143147
meta as userProfileWeb3WalletsSectionMeta,
@@ -295,13 +299,18 @@ const userProfileWeb3WalletsSectionModule: StoryModule = {
295299
meta: userProfileWeb3WalletsSectionMeta,
296300
Default: UserProfileWeb3WalletsSectionDefault,
297301
};
302+
const userProfileDeleteSectionModule: StoryModule = {
303+
meta: userProfileDeleteSectionMeta,
304+
Default: UserProfileDeleteSectionDefault,
305+
};
298306

299307
export const registry: StoryModule[] = [
300308
// User
301309
userButtonModule,
302310
userProfileAccountSectionModule,
303311
userProfileConnectedAccountsSectionModule,
304312
userProfileWeb3WalletsSectionModule,
313+
userProfileDeleteSectionModule,
305314
// Organization
306315
organizationProfileModule,
307316
organizationProfileGeneralPanelModule,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as Stories from './user-profile-delete-section.stories';
2+
3+
# UserProfileDeleteSection
4+
5+
The terminal destructive action for deleting the current user account.
6+
7+
<Story
8+
name='Default'
9+
storyModule={Stories}
10+
composition={[
11+
{ name: 'Section', href: '/components/section', layer: 'Components' },
12+
{ name: 'Button', href: '/components/button', layer: 'Components' },
13+
]}
14+
/>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/** @jsxImportSource @emotion/react */
2+
import { UserProfileDeleteSectionView } from '@clerk/ui/mosaic/user-profile/user-profile-delete-section.view';
3+
4+
import type { StoryMeta } from '@/lib/types';
5+
6+
export { default as __source } from './user-profile-delete-section.stories?raw';
7+
8+
export const meta: StoryMeta = {
9+
group: 'User',
10+
title: 'UserProfileDeleteSection',
11+
source: 'packages/ui/src/mosaic/user-profile/user-profile-delete-section.view.tsx',
12+
styleEngine: 'stylex',
13+
};
14+
15+
export function Default() {
16+
return <UserProfileDeleteSectionView onDelete={() => undefined} />;
17+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Button } from '../components/button';
2+
import { Section } from '../components/section';
3+
4+
export interface UserProfileDeleteSectionViewProps {
5+
onDelete: () => void;
6+
}
7+
8+
export function UserProfileDeleteSectionView({ onDelete }: UserProfileDeleteSectionViewProps) {
9+
return (
10+
<Section.Root>
11+
<Section.Title>Danger zone</Section.Title>
12+
<Section.Group>
13+
<Section.Row>
14+
<Section.Item>
15+
<Section.Content>
16+
<Section.Label>Delete account</Section.Label>
17+
<Section.Description>This action is permanent and irreversible.</Section.Description>
18+
</Section.Content>
19+
<Section.Actions>
20+
<Button
21+
color='negative'
22+
size='sm'
23+
variant='ghost'
24+
onClick={onDelete}
25+
>
26+
Delete account
27+
</Button>
28+
</Section.Actions>
29+
</Section.Item>
30+
</Section.Row>
31+
</Section.Group>
32+
</Section.Root>
33+
);
34+
}

0 commit comments

Comments
 (0)