Skip to content

Commit

Permalink
chore: Deprecate ClerkLayout Astro component (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef authored Jun 20, 2024
1 parent dbc696b commit 211f86b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-parrots-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro-clerk-auth": minor
---

Deprecate `ClerkLayout` Astro component. It's usage it is no longer needed as this is now handled my `clerkMiiddleware`.
20 changes: 10 additions & 10 deletions apps/playground-with-package/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import Install from "../components/Install.astro";

<Layout title="Welcome to Astro.">
<h1>Welcome to <span class="text-gradient">Astro</span></h1>
<SignedIn>
<OrganizationSwitcher
appearance={{
elements: {
organizationPreview__organizationSwitcherTrigger: "text-white",
organizationSwitcherTriggerIcon: "text-white",
},
}}
afterSelectOrganizationUrl="/organization"
/>
<SignedIn>
<OrganizationSwitcher
appearance={{
elements: {
organizationPreview__organizationSwitcherTrigger: "text-white",
organizationSwitcherTriggerIcon: "text-white",
},
}}
afterSelectOrganizationUrl="/organization"
/>
<SignOutButton />
</SignedIn>

Expand Down
19 changes: 0 additions & 19 deletions packages/astro-clerk-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,6 @@ export const onRequest = clerkMiddleware((auth, context, next) => {
});
```

## Wrap each page with `ClerkLayout` (Only required for SSR with React)
In order to properly support SSR, you need to wrap each page in your app with the `ClerkLayout` Astro component.

Example Page `my-page.astro`
```astro
---
import Layout from "../layouts/Layout.astro";
import { OrganizationList } from "astro-clerk-auth/components/interactive";
import { ClerkLayout } from "astro-clerk-auth/components/control";
---
<ClerkLayout>
<Layout title="Welcome to Astro.">
...
</Layout>
</ClerkLayout>
```

## Use Clerk UI Components
Supported components
- [SignIn](https://clerk.com/docs/components/authentication/sign-in)
Expand Down
11 changes: 9 additions & 2 deletions packages/astro-clerk-auth/src/astro-components/control/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components`
// virtual module's types, which means that `tsc` will try to resolve these imports. Don't mind the editor errors.

// @ts-ignore
export { default as ClerkLayout } from './ClerkLayout.astro';
import { default as ClerkLayoutDeprecated } from './ClerkLayout.astro';

/**
* @deprecated It's usage is no longer necessary, it can be safely removed.
*/
const ClerkLayout = ClerkLayoutDeprecated;

export { ClerkLayout };
// @ts-ignore
export { default as SignedIn } from './SignedIn.astro';
// @ts-ignore
export { default as SignedOut } from './SignedOut.astro';
// @ts-ignore
export { default as Protect } from './Protect.astro';

0 comments on commit 211f86b

Please sign in to comment.