Skip to content

Commit 89ce1a7

Browse files
committed
feat: Add custom account row label component
1 parent e7aec9e commit 89ce1a7

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import { AccountRowLabel as AccountRowLabel_06d0cb594d8f6ba2ac35015f930c882e } from 'payload-authjs/components'
12
import { SignInWithAuthjsButton as SignInWithAuthjsButton_06d0cb594d8f6ba2ac35015f930c882e } from 'payload-authjs/components'
23
import { default as default_2c1e1c35da30a80d88551f9fcc61be66 } from 'src/payload/components/Greeting'
34

45
export const importMap = {
6+
"payload-authjs/components#AccountRowLabel": AccountRowLabel_06d0cb594d8f6ba2ac35015f930c882e,
57
"payload-authjs/components#SignInWithAuthjsButton": SignInWithAuthjsButton_06d0cb594d8f6ba2ac35015f930c882e,
68
"/Greeting#default": default_2c1e1c35da30a80d88551f9fcc61be66
79
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use client";
2+
3+
import { useRowLabel } from "@payloadcms/ui";
4+
import type { Account } from "../authjs/types";
5+
6+
export const AccountRowLabel = () => {
7+
const { data: account } = useRowLabel<Account>();
8+
9+
return (
10+
<div
11+
style={{
12+
display: "flex",
13+
alignItems: "center",
14+
gap: "0.5rem",
15+
}}
16+
>
17+
<img
18+
loading="lazy"
19+
src={`https://authjs.dev/img/providers/${account.provider}.svg`}
20+
alt="Provider"
21+
style={{
22+
width: "1.5rem",
23+
height: "1.5rem",
24+
}}
25+
/>
26+
<strong>{account.provider}</strong> ({account.providerAccountId})
27+
</div>
28+
);
29+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export { AccountRowLabel } from "./AccountRowLabel";
12
export { SignInWithAuthjsButton } from "./SignInWithAuthjsButton";

packages/payload-authjs/src/payload/collection/fields/accounts.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export const accountsField: Field = {
2727
],
2828
admin: {
2929
initCollapsed: true,
30+
components: {
31+
RowLabel: "payload-authjs/components#AccountRowLabel",
32+
},
3033
},
3134
access: {
3235
create: () => false,

0 commit comments

Comments
 (0)