Skip to content

Commit

Permalink
chore(repo): Drop deprecated apis from playground/nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosdouvlis committed Dec 14, 2023
1 parent 370b17b commit c469c67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 59 deletions.
26 changes: 1 addition & 25 deletions playground/nextjs12/pages/session-examples/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WithSession, withSession, WithSessionProp, useSession } from '@clerk/nextjs';
import { useSession } from '@clerk/nextjs';
import { PublicUserData } from '@clerk/types';
import type { NextPage } from 'next';
import React from 'react';
Expand All @@ -20,36 +20,12 @@ function PublicMetadataWithHook() {
return <Template publicUserData={session?.publicUserData} />;
}

class PublicMetadataClass extends React.Component<WithSessionProp> {
render() {
return <Template publicUserData={this.props.session.publicUserData} />;
}
}

export const PublicMetadataClassHOC = withSession(PublicMetadataClass);

const PublicMetadataFn = (props: WithSessionProp) => {
const { session } = props;
return <Template publicUserData={session?.publicUserData} />;
};

export const PublicMetadataFnHOC = withSession(PublicMetadataFn);

class PublicMetadataFaaC extends React.Component {
render() {
return <WithSession>{session => <Template publicUserData={session?.publicUserData} />}</WithSession>;
}
}

const SessionExamplesPage: NextPage = () => {
return (
<div
style={{ display: 'flex', flexDirection: 'column', gap: '2rem', justifyContent: 'center', alignItems: 'center' }}
>
<PublicMetadataWithHook />
<PublicMetadataClassHOC />
<PublicMetadataFnHOC />
<PublicMetadataFaaC />
</div>
);
};
Expand Down
35 changes: 1 addition & 34 deletions playground/nextjs12/pages/user-examples/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NextPage } from 'next';
import React from 'react';
import { useUser, withUser, WithUser, WithUserProp } from '@clerk/nextjs';
import { useUser } from '@clerk/nextjs';

function GreetingWithHook() {
// Use the useUser hook to get the Clerk.user object
Expand All @@ -15,45 +15,12 @@ function GreetingWithHook() {
return <div>Hello, {user.firstName}!</div>;
}

class GreetingClass extends React.Component<WithUserProp> {
render() {
return <div>{this.props.user.firstName ? `Hello ${this.props.user.firstName}!` : 'Hello there!'}</div>;
}
}

export const GreetingClassHOC = withUser(GreetingClass);

type GreetingProps = {
greeting: string;
};

const GreetingFn = (props: WithUserProp<GreetingProps>) => {
const { user, greeting } = props;
return (
<>
<h1>{greeting}</h1>
<div>{user.firstName ? `Hello, ${user.firstName}!` : 'Hello there!'}</div>
</>
);
};

export const GreetingFnHOC = withUser(GreetingFn);

class GreetingFaaC extends React.Component {
render() {
return <WithUser>{user => <div>{user.firstName ? `Hello, ${user.firstName}!` : 'Hello there!'}</div>}</WithUser>;
}
}

const UserExamplesPage: NextPage = () => {
return (
<div
style={{ display: 'flex', flexDirection: 'column', gap: '2rem', justifyContent: 'center', alignItems: 'center' }}
>
<GreetingWithHook />
<GreetingClassHOC />
<GreetingFnHOC greeting={'Ciao'} />
<GreetingFaaC />
</div>
);
};
Expand Down

0 comments on commit c469c67

Please sign in to comment.