Skip to content

Commit fced4c3

Browse files
feat(ui): add user profile delete section
1 parent 442a857 commit fced4c3

6 files changed

Lines changed: 66 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
@@ -141,6 +141,10 @@ import {
141141
Default as UserProfileConnectedAccountsSectionDefault,
142142
meta as userProfileConnectedAccountsSectionMeta,
143143
} from '../stories/user-profile-connected-accounts-section.stories';
144+
import {
145+
Default as UserProfileDeleteSectionDefault,
146+
meta as userProfileDeleteSectionMeta,
147+
} from '../stories/user-profile-delete-section.stories';
144148
import {
145149
Default as UserProfileWeb3WalletsSectionDefault,
146150
meta as userProfileWeb3WalletsSectionMeta,
@@ -301,13 +305,18 @@ const userProfileWeb3WalletsSectionModule: StoryModule = {
301305
meta: userProfileWeb3WalletsSectionMeta,
302306
Default: UserProfileWeb3WalletsSectionDefault,
303307
};
308+
const userProfileDeleteSectionModule: StoryModule = {
309+
meta: userProfileDeleteSectionMeta,
310+
Default: UserProfileDeleteSectionDefault,
311+
};
304312

305313
export const registry: StoryModule[] = [
306314
// User
307315
userButtonModule,
308316
userProfileAccountSectionModule,
309317
userProfileConnectedAccountsSectionModule,
310318
userProfileWeb3WalletsSectionModule,
319+
userProfileDeleteSectionModule,
311320
// Organization
312321
organizationProfileModule,
313322
organizationProfileGeneralPanelModule,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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 name='Default' storyModule={Stories} composition={[{ name: 'SettingsGroup', href: '/blocks/settings-group', layer: 'Blocks' }]} />
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: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { SettingsGroup } from '../block/settings-group';
2+
import { Button } from '../components/button';
3+
4+
export interface UserProfileDeleteSectionViewProps {
5+
onDelete: () => void;
6+
}
7+
8+
export function UserProfileDeleteSectionView({ onDelete }: UserProfileDeleteSectionViewProps) {
9+
return (
10+
<SettingsGroup.Root title='Danger zone'>
11+
<SettingsGroup.List>
12+
<SettingsGroup.Row>
13+
<SettingsGroup.Label description='This action is permanent and irreversible.'>
14+
Delete account
15+
</SettingsGroup.Label>
16+
<SettingsGroup.Control>
17+
<Button
18+
color='negative'
19+
size='sm'
20+
variant='outline'
21+
onClick={onDelete}
22+
>
23+
Delete account
24+
</Button>
25+
</SettingsGroup.Control>
26+
</SettingsGroup.Row>
27+
</SettingsGroup.List>
28+
</SettingsGroup.Root>
29+
);
30+
}

0 commit comments

Comments
 (0)