Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/slow-apricots-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"arrowParens": "avoid",
"bracketSpacing": true,
"jsxSingleQuote": true,
"plugins": ["prettier-plugin-packagejson", "prettier-plugin-tailwindcss"],
"plugins": ["prettier-plugin-packagejson", "prettier-plugin-tailwindcss", "prettier-plugin-astro"],
"printWidth": 120,
"semi": true,
"singleAttributePerLine": true,
Expand Down
25 changes: 19 additions & 6 deletions integration/templates/astro-hybrid/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,26 @@ const { title } = Astro.props;
---

<!doctype html>
<html lang="en">
<html lang='en'>
<head>
<meta charset="UTF-8" />
<meta name="description" content="Astro description" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<meta charset='UTF-8' />
<meta
name='description'
content='Astro description'
/>
<meta
name='viewport'
content='width=device-width, initial-scale=1.0'
/>
<link
rel='icon'
type='image/svg+xml'
href='/favicon.svg'
/>
<meta
name='generator'
content={Astro.generator}
/>
<title>{title}</title>
</head>
<body>
Expand Down
29 changes: 16 additions & 13 deletions integration/templates/astro-hybrid/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
import { UserButton, SignInButton, SignedIn, SignedOut } from "@clerk/astro/components";
import { OrganizationSwitcher } from "@clerk/astro/react";
import Layout from "../layouts/Layout.astro";
import { UserButton, SignInButton, SignedIn, SignedOut } from '@clerk/astro/components';
import { OrganizationSwitcher } from '@clerk/astro/react';
import Layout from '../layouts/Layout.astro';

export const prerender = true;
---

<Layout title="Home">
<SignedOut>
<h1>Signed out</h1>
<SignInButton mode="modal" fallbackRedirectUrl="/" />
</SignedOut>
<SignedIn>
<h1>Signed in</h1>
<UserButton />
<OrganizationSwitcher client:only="react" />
</SignedIn>
<Layout title='Home'>
<SignedOut>
<h1>Signed out</h1>
<SignInButton
mode='modal'
fallbackRedirectUrl='/'
/>
</SignedOut>
<SignedIn>
<h1>Signed in</h1>
<UserButton />
<OrganizationSwitcher client:only='react' />
</SignedIn>
</Layout>
14 changes: 7 additions & 7 deletions integration/templates/astro-hybrid/src/pages/only-admins.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
import { Protect } from "@clerk/astro/components";
import Layout from "../layouts/Layout.astro";
import { Protect } from '@clerk/astro/components';
import Layout from '../layouts/Layout.astro';

export const prerender = true;
---

<Layout title="Protected">
<Protect role="org:admin">
<h1>I'm an admin</h1>
<h1 slot="fallback">Not an admin</h1>
</Protect>
<Layout title='Protected'>
<Protect role='org:admin'>
<h1>I'm an admin</h1>
<h1 slot='fallback'>Not an admin</h1>
</Protect>
</Layout>
17 changes: 10 additions & 7 deletions integration/templates/astro-hybrid/src/pages/only-members.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
---
import { Protect } from "@clerk/astro/components";
import Layout from "../layouts/Layout.astro";
import { Protect } from '@clerk/astro/components';
import Layout from '../layouts/Layout.astro';

export const prerender = false;
---

<Layout title="Protected">
<Protect role="basic_member" isStatic={false}>
<h1>I'm a member</h1>
<h1 slot="fallback">Not a member</h1>
</Protect>
<Layout title='Protected'>
<Protect
role='basic_member'
isStatic={false}
>
<h1>I'm a member</h1>
<h1 slot='fallback'>Not a member</h1>
</Protect>
</Layout>
29 changes: 16 additions & 13 deletions integration/templates/astro-hybrid/src/pages/ssr.astro
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
import { UserButton, SignInButton, SignedIn, SignedOut } from "@clerk/astro/components";
import { OrganizationSwitcher } from "@clerk/astro/react";
import Layout from "../layouts/Layout.astro";
import { UserButton, SignInButton, SignedIn, SignedOut } from '@clerk/astro/components';
import { OrganizationSwitcher } from '@clerk/astro/react';
import Layout from '../layouts/Layout.astro';

export const prerender = false;
---

<Layout title="Home">
<SignedOut isStatic={false}>
<h1>Signed out</h1>
<SignInButton mode="modal" fallbackRedirectUrl="/" />
</SignedOut>
<SignedIn isStatic={false}>
<h1>Signed in</h1>
<UserButton />
<OrganizationSwitcher client:load />
</SignedIn>
<Layout title='Home'>
<SignedOut isStatic={false}>
<h1>Signed out</h1>
<SignInButton
mode='modal'
fallbackRedirectUrl='/'
/>
</SignedOut>
<SignedIn isStatic={false}>
<h1>Signed in</h1>
<UserButton />
<OrganizationSwitcher client:load />
</SignedIn>
</Layout>
102 changes: 51 additions & 51 deletions integration/templates/astro-node/src/components/Card.astro
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
---
interface Props {
title: string;
body: string;
href: string;
title: string;
body: string;
href: string;
}

const { href, title, body } = Astro.props;
---

<li class="link-card">
<a href={href}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
{body}
</p>
</a>
<li class='link-card'>
<a href={href}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
{body}
</p>
</a>
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 1px;
background-color: #23262d;
background-image: none;
background-size: 400%;
border-radius: 7px;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.link-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: calc(1.5rem - 1px);
border-radius: 8px;
color: white;
background-color: #23262d;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
background-image: var(--accent-gradient);
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent-light));
}
.link-card {
list-style: none;
display: flex;
padding: 1px;
background-color: #23262d;
background-image: none;
background-size: 400%;
border-radius: 7px;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.link-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: calc(1.5rem - 1px);
border-radius: 8px;
color: white;
background-color: #23262d;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
background-image: var(--accent-gradient);
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent-light));
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@
import { UserButton } from '@clerk/astro/components';
---

<UserButton afterSignOutUrl="/">
<UserButton.MenuItems>
<UserButton.Action label="signOut" />
<UserButton.Action label="manageAccount" />
<UserButton.Link label="Custom link" href="/user">
<div slot="label-icon">Icon</div>
</UserButton.Link>
<UserButton.Action label="Custom action" open="terms">
<div slot="label-icon">Icon</div>
</UserButton.Action>
<UserButton.Action label="Custom click" clickIdentifier="custom_click">
<div slot="label-icon">Icon</div>
</UserButton.Action>
</UserButton.MenuItems>
<UserButton.UserProfilePage label="Terms" url="terms">
<div slot="label-icon">Icon</div>
<div>
<h1>Custom Terms Page</h1>
<p>This is the custom terms page</p>
</div>
</UserButton.UserProfilePage>
<UserButton afterSignOutUrl='/'>
<UserButton.MenuItems>
<UserButton.Action label='signOut' />
<UserButton.Action label='manageAccount' />
<UserButton.Link
label='Custom link'
href='/user'
>
<div slot='label-icon'>Icon</div>
</UserButton.Link>
<UserButton.Action
label='Custom action'
open='terms'
>
<div slot='label-icon'>Icon</div>
</UserButton.Action>
<UserButton.Action
label='Custom click'
clickIdentifier='custom_click'
>
<div slot='label-icon'>Icon</div>
</UserButton.Action>
</UserButton.MenuItems>
<UserButton.UserProfilePage
label='Terms'
url='terms'
>
<div slot='label-icon'>Icon</div>
<div>
<h1>Custom Terms Page</h1>
<p>This is the custom terms page</p>
</div>
</UserButton.UserProfilePage>
</UserButton>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
import { Code } from "astro:components";
import { Code } from 'astro:components';
const user = await Astro.locals.currentUser();
---

<Code code={JSON.stringify(user)} lang={"json"} wrap />
<Code
code={JSON.stringify(user)}
lang={'json'}
wrap
/>
Loading