Skip to content

Commit

Permalink
feat(astro): Introduce <Waitlist /> component (#4650)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikospapcom authored Nov 25, 2024
1 parent c7f509e commit aa94dbd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-roses-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/astro': minor
---

Introduce `<Waitlist />` component for Astro
1 change: 1 addition & 0 deletions packages/astro/src/astro-components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ export { OrganizationProfile } from './interactive/OrganizationProfile';
export { OrganizationSwitcher } from './interactive/OrganizationSwitcher';
export { default as OrganizationList } from './interactive/OrganizationList.astro';
export { default as GoogleOneTap } from './interactive/GoogleOneTap.astro';
export { default as Waitlist } from './interactive/Waitlist.astro';
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
---
interface Props {
[key: string]: unknown
id?: string
component: 'sign-in' | 'sign-up' | 'organization-list' | 'organization-profile' | 'organization-switcher' | 'user-button' | 'user-profile' | 'google-one-tap'
[key: string]: unknown;
id?: string;
component:
| 'sign-in'
| 'sign-up'
| 'organization-list'
| 'organization-profile'
| 'organization-switcher'
| 'user-button'
| 'user-profile'
| 'google-one-tap'
| 'waitlist';
}
import { generateSafeId } from '@clerk/astro/internal';
const { component, id, ...props } = Astro.props
const { component, id, ...props } = Astro.props;
const safeId = id || generateSafeId();
---
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
import type { WaitlistProps } from "@clerk/types";
type Props = WaitlistProps
import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---

<InternalUIComponentRenderer {...Astro.props} component="waitlist" />
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const mountAllClerkAstroJSComponents = () => {
'sign-in': 'mountSignIn',
'sign-up': 'mountSignUp',
'google-one-tap': 'openGoogleOneTap',
waitlist: 'mountWaitlist',
} as const;

Object.entries(mountFns).forEach(([category, mountFn]) => {
Expand Down
11 changes: 11 additions & 0 deletions packages/astro/src/react/uiComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type {
SignUpProps,
UserButtonProps,
UserProfileProps,
WaitlistProps,
} from '@clerk/types';
import React from 'react';

Expand Down Expand Up @@ -174,3 +175,13 @@ export const GoogleOneTap = withClerk(({ clerk, ...props }: WithClerkProp<Google
/>
);
}, 'GoogleOneTap');

export const Waitlist = withClerk(({ clerk, ...props }: WithClerkProp<WaitlistProps>) => {
return (
<Portal
mount={clerk?.mountWaitlist}
unmount={clerk?.unmountWaitlist}
props={props}
/>
);
}, 'Waitlist');

0 comments on commit aa94dbd

Please sign in to comment.