diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 59c89cf..b6516a0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,6 +16,7 @@ jobs:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.14.0
with:
+ node-version: 20.10.0
main-branch-name: main
number-of-agents: 3
init-commands: |
@@ -31,4 +32,5 @@ jobs:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.14.0
with:
+ node-version: 20.10.0
number-of-agents: 3
diff --git a/apps/web/src/app/features/demo/demo-feature-anchor.tsx b/apps/web/src/app/features/demo/demo-feature-anchor.tsx
new file mode 100644
index 0000000..ab2d2a4
--- /dev/null
+++ b/apps/web/src/app/features/demo/demo-feature-anchor.tsx
@@ -0,0 +1,16 @@
+import { SimpleGrid } from '@mantine/core'
+import { UiAnchor, UiCard } from '@pubkey-ui/core'
+
+export function DemoFeatureAnchor() {
+ return (
+
+
+ Anchor with To
+
+ Anchor without To
+
+ Anchor without To
+
+
+ )
+}
diff --git a/apps/web/src/app/features/demo/demo-feature.tsx b/apps/web/src/app/features/demo/demo-feature.tsx
index abe8983..74f01bd 100644
--- a/apps/web/src/app/features/demo/demo-feature.tsx
+++ b/apps/web/src/app/features/demo/demo-feature.tsx
@@ -3,6 +3,7 @@ import { UiNotFound, UiPage, UiStack } from '@pubkey-ui/core'
import { ReactNode } from 'react'
import { Link, Navigate, useLocation, useRoutes } from 'react-router-dom'
import { DemoFeatureAlerts } from './demo-feature-alerts'
+import { DemoFeatureAnchor } from './demo-feature-anchor'
import { DemoFeatureBack } from './demo-feature-back'
import { DemoFeatureCard } from './demo-feature-card'
import { DemoFeatureCopy } from './demo-feature-copy'
@@ -30,6 +31,7 @@ export function DemoFeature() {
element: ReactNode
}[] = [
{ path: 'alerts', label: 'Alerts', element: },
+ { path: 'anchor', label: 'Anchor', element: },
{ path: 'back', label: 'Back', element: },
{ path: 'card', label: 'Card', element: },
{ path: 'copy', label: 'Copy', element: },
diff --git a/package.json b/package.json
index ad36c1a..579ae15 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"sync-schemas": "ts-node ./tools/scripts/sync-schemas.ts"
},
"private": true,
+ "packageManager": "pnpm@8.14.0",
"dependencies": {
"@coral-xyz/anchor": "^0.29.0",
"@mantine/core": "^7.3.0",
diff --git a/packages/core/src/lib/index.ts b/packages/core/src/lib/index.ts
index cb6fe72..e532f40 100644
--- a/packages/core/src/lib/index.ts
+++ b/packages/core/src/lib/index.ts
@@ -1,4 +1,5 @@
export * from './ui-alert'
+export * from './ui-anchor'
export * from './ui-back'
export * from './ui-card'
export * from './ui-container'
diff --git a/packages/core/src/lib/ui-anchor/index.ts b/packages/core/src/lib/ui-anchor/index.ts
new file mode 100644
index 0000000..4135022
--- /dev/null
+++ b/packages/core/src/lib/ui-anchor/index.ts
@@ -0,0 +1 @@
+export * from './ui-anchor'
diff --git a/packages/core/src/lib/ui-anchor/ui-anchor.tsx b/packages/core/src/lib/ui-anchor/ui-anchor.tsx
new file mode 100644
index 0000000..817aec9
--- /dev/null
+++ b/packages/core/src/lib/ui-anchor/ui-anchor.tsx
@@ -0,0 +1,24 @@
+import { Anchor, AnchorProps } from '@mantine/core'
+import { ReactNode } from 'react'
+import { Link } from 'react-router-dom'
+
+export interface UiAnchorProps extends AnchorProps {
+ children: ReactNode
+ href?: string
+ to?: string
+ target?: HTMLAnchorElement['target']
+}
+
+export function UiAnchor({ children, href, target, to, ...props }: UiAnchorProps) {
+ return to ? (
+
+ {children}
+
+ ) : href ? (
+
+ {children}
+
+ ) : (
+ children
+ )
+}
diff --git a/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap b/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap
index 84ae845..33abf1f 100644
--- a/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap
+++ b/packages/generators/src/generators/component/__snapshots__/component-generator.spec.ts.snap
@@ -121,6 +121,96 @@ exports[`component generator should create files for alert 1`] = `
}
`;
+exports[`component generator should create files for anchor 1`] = `
+{
+ ".prettierrc": {
+ "content": [
+ "{ "singleQuote": true }",
+ ],
+ "isBinary": false,
+ "path": "./.prettierrc",
+ },
+ "nx.json": {
+ "content": [
+ "{",
+ ""affected": { "defaultBase": "main" },",
+ ""targetDefaults": { "build": { "cache": true }, "lint": { "cache": true } }",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./nx.json",
+ },
+ "package.json": {
+ "content": [
+ "{",
+ ""name": "@proj/source",",
+ ""dependencies": {},",
+ ""devDependencies": {}",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./package.json",
+ },
+ "test": {
+ "children": {
+ "index.ts": {
+ "content": [
+ "export * from './ui-anchor';",
+ ],
+ "isBinary": false,
+ "path": "./test/index.ts",
+ },
+ "ui-anchor.tsx": {
+ "content": [
+ "import { Anchor, AnchorProps } from '@mantine/core';",
+ "import { ReactNode } from 'react';",
+ "import { Link } from 'react-router-dom';",
+ "export interface UiAnchorProps extends AnchorProps {",
+ "children: ReactNode;",
+ "href?: string;",
+ "to?: string;",
+ "target?: HTMLAnchorElement['target'];",
+ "}",
+ "export function UiAnchor({",
+ "children,",
+ "href,",
+ "target,",
+ "to,",
+ "...props",
+ "}: UiAnchorProps) {",
+ "return to ? (",
+ "",
+ "{children}",
+ "",
+ ") : href ? (",
+ "",
+ "{children}",
+ "",
+ ") : (",
+ "children",
+ ");",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./test/ui-anchor.tsx",
+ },
+ },
+ "path": "./test",
+ },
+ "tsconfig.base.json": {
+ "content": [
+ "{",
+ ""compilerOptions": {",
+ ""paths": {}",
+ "}",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./tsconfig.base.json",
+ },
+}
+`;
+
exports[`component generator should create files for back 1`] = `
{
".prettierrc": {
diff --git a/packages/generators/src/generators/component/component-generator-schema.d.ts b/packages/generators/src/generators/component/component-generator-schema.d.ts
index a49af3c..af22d59 100644
--- a/packages/generators/src/generators/component/component-generator-schema.d.ts
+++ b/packages/generators/src/generators/component/component-generator-schema.d.ts
@@ -15,6 +15,7 @@ export interface ComponentGeneratorSchema {
*/
type:
| 'alert'
+ | 'anchor'
| 'back'
| 'card'
| 'container'
diff --git a/packages/generators/src/generators/component/component-generator-schema.json b/packages/generators/src/generators/component/component-generator-schema.json
index d1bb344..835d5c6 100644
--- a/packages/generators/src/generators/component/component-generator-schema.json
+++ b/packages/generators/src/generators/component/component-generator-schema.json
@@ -17,6 +17,7 @@
"description": "The type of component to create",
"enum": [
"alert",
+ "anchor",
"back",
"card",
"container",
diff --git a/packages/generators/src/generators/component/component-types.ts b/packages/generators/src/generators/component/component-types.ts
index cbff49d..488de69 100644
--- a/packages/generators/src/generators/component/component-types.ts
+++ b/packages/generators/src/generators/component/component-types.ts
@@ -2,6 +2,7 @@ import { ComponentGeneratorSchema } from './component-generator-schema'
export const componentTypes: ComponentGeneratorSchema['type'][] = [
'alert',
+ 'anchor',
'back',
'card',
'container',
diff --git a/packages/generators/src/generators/component/files/anchor/__prefixFileName__-anchor.tsx.template b/packages/generators/src/generators/component/files/anchor/__prefixFileName__-anchor.tsx.template
new file mode 100644
index 0000000..e0a295a
--- /dev/null
+++ b/packages/generators/src/generators/component/files/anchor/__prefixFileName__-anchor.tsx.template
@@ -0,0 +1,24 @@
+import { Anchor, AnchorProps } from '@mantine/core'
+import { ReactNode } from 'react'
+import { Link } from 'react-router-dom'
+
+export interface <%= prefix.className %>AnchorProps extends AnchorProps {
+ children: ReactNode
+ href?: string
+ to?: string
+ target?: HTMLAnchorElement['target']
+}
+
+export function <%= prefix.className %>Anchor({ children, href, target, to, ...props }: <%= prefix.className %>AnchorProps) {
+ return to ? (
+
+ {children}
+
+ ) : href ? (
+
+ {children}
+
+ ) : (
+ children
+ )
+}
diff --git a/packages/generators/src/generators/component/files/anchor/index.ts.template b/packages/generators/src/generators/component/files/anchor/index.ts.template
new file mode 100644
index 0000000..0103471
--- /dev/null
+++ b/packages/generators/src/generators/component/files/anchor/index.ts.template
@@ -0,0 +1 @@
+export * from './<%= prefixFileName %>-anchor'
diff --git a/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap b/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap
index 2ec2236..8c2f991 100644
--- a/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap
+++ b/packages/generators/src/generators/components/__snapshots__/components-generator.spec.ts.snap
@@ -35,6 +35,7 @@ exports[`components generator should run successfully 1`] = `
"index.ts": {
"content": [
"export * from './ui-alert';",
+ "export * from './ui-anchor';",
"export * from './ui-back';",
"export * from './ui-card';",
"export * from './ui-container';",
@@ -138,6 +139,52 @@ exports[`components generator should run successfully 1`] = `
},
"path": "./test/ui-alert",
},
+ "ui-anchor": {
+ "children": {
+ "index.ts": {
+ "content": [
+ "export * from './ui-anchor';",
+ ],
+ "isBinary": false,
+ "path": "./test/ui-anchor/index.ts",
+ },
+ "ui-anchor.tsx": {
+ "content": [
+ "import { Anchor, AnchorProps } from '@mantine/core';",
+ "import { ReactNode } from 'react';",
+ "import { Link } from 'react-router-dom';",
+ "export interface UiAnchorProps extends AnchorProps {",
+ "children: ReactNode;",
+ "href?: string;",
+ "to?: string;",
+ "target?: HTMLAnchorElement['target'];",
+ "}",
+ "export function UiAnchor({",
+ "children,",
+ "href,",
+ "target,",
+ "to,",
+ "...props",
+ "}: UiAnchorProps) {",
+ "return to ? (",
+ "",
+ "{children}",
+ "",
+ ") : href ? (",
+ "",
+ "{children}",
+ "",
+ ") : (",
+ "children",
+ ");",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./test/ui-anchor/ui-anchor.tsx",
+ },
+ },
+ "path": "./test/ui-anchor",
+ },
"ui-back": {
"children": {
"index.ts": {
diff --git a/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap b/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap
index b60483c..81e5041 100644
--- a/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap
+++ b/packages/generators/src/generators/feature/__snapshots__/feature-generator.spec.ts.snap
@@ -60,6 +60,27 @@ exports[`feature generator should create files for demo 1`] = `
"isBinary": false,
"path": "./test/demo-feature-alerts.tsx",
},
+ "demo-feature-anchor.tsx": {
+ "content": [
+ "import { SimpleGrid } from '@mantine/core';",
+ "import { UiAnchor, UiCard } from '@pubkey-ui/core';",
+ "export function DemoFeatureAnchor() {",
+ "return (",
+ "",
+ "",
+ "Anchor with To",
+ "",
+ "Anchor without To",
+ "",
+ "Anchor without To",
+ "",
+ "",
+ ");",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./test/demo-feature-anchor.tsx",
+ },
"demo-feature-back.tsx": {
"content": [
"import { UiBack, UiCard } from '@pubkey-ui/core';",
@@ -885,6 +906,7 @@ exports[`feature generator should create files for demo 1`] = `
"import { ReactNode } from 'react';",
"import { Link, Navigate, useLocation, useRoutes } from 'react-router-dom';",
"import { DemoFeatureAlerts } from './demo-feature-alerts';",
+ "import { DemoFeatureAnchor } from './demo-feature-anchor';",
"import { DemoFeatureBack } from './demo-feature-back';",
"import { DemoFeatureCard } from './demo-feature-card';",
"import { DemoFeatureCopy } from './demo-feature-copy';",
@@ -911,6 +933,7 @@ exports[`feature generator should create files for demo 1`] = `
"element: ReactNode;",
"}[] = [",
"{ path: 'alerts', label: 'Alerts', element: },",
+ "{ path: 'anchor', label: 'Anchor', element: },",
"{ path: 'back', label: 'Back', element: },",
"{ path: 'card', label: 'Card', element: },",
"{ path: 'copy', label: 'Copy', element: },",
diff --git a/packages/generators/src/generators/feature/files/demo/demo-feature-anchor.tsx.template b/packages/generators/src/generators/feature/files/demo/demo-feature-anchor.tsx.template
new file mode 100644
index 0000000..8bc4855
--- /dev/null
+++ b/packages/generators/src/generators/feature/files/demo/demo-feature-anchor.tsx.template
@@ -0,0 +1,16 @@
+import { SimpleGrid } from '@mantine/core'
+import { <%= prefix.className %>Anchor, <%= prefix.className %>Card } from '<%= uiImport %>'
+
+export function DemoFeatureAnchor() {
+ return (
+ <<%= prefix.className %>Card title="Anchor">
+
+ <<%= prefix.className %>Anchor to="/">Anchor with To<%= prefix.className %>Anchor>
+ <<%= prefix.className %>Anchor href="https://google.com" target="_blank">
+ Anchor without To
+ <%= prefix.className %>Anchor>
+ <<%= prefix.className %>Anchor>Anchor without To<%= prefix.className %>Anchor>
+
+ <%= prefix.className %>Card>
+ )
+}
diff --git a/packages/generators/src/generators/feature/files/demo/demo-feature.tsx.template b/packages/generators/src/generators/feature/files/demo/demo-feature.tsx.template
index 8bc8443..0b1628f 100644
--- a/packages/generators/src/generators/feature/files/demo/demo-feature.tsx.template
+++ b/packages/generators/src/generators/feature/files/demo/demo-feature.tsx.template
@@ -3,6 +3,7 @@ import { <%= prefix.className %>NotFound, <%= prefix.className %>Page, <%= prefi
import { ReactNode } from 'react'
import { Link, Navigate, useLocation, useRoutes } from 'react-router-dom'
import { DemoFeatureAlerts } from './demo-feature-alerts'
+import { DemoFeatureAnchor } from './demo-feature-anchor'
import { DemoFeatureBack } from './demo-feature-back'
import { DemoFeatureCard } from './demo-feature-card'
import { DemoFeatureCopy } from './demo-feature-copy'
@@ -30,6 +31,7 @@ export function DemoFeature() {
element: ReactNode
}[] = [
{ path: 'alerts', label: 'Alerts', element: },
+ { path: 'anchor', label: 'Anchor', element: },
{ path: 'back', label: 'Back', element: },
{ path: 'card', label: 'Card', element: },
{ path: 'copy', label: 'Copy', element: },
diff --git a/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap b/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap
index 8ae63d4..7af6565 100644
--- a/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap
+++ b/packages/generators/src/generators/features/__snapshots__/features-generator.spec.ts.snap
@@ -62,6 +62,27 @@ exports[`features generator should run successfully 1`] = `
"isBinary": false,
"path": "./test/demo/demo-feature-alerts.tsx",
},
+ "demo-feature-anchor.tsx": {
+ "content": [
+ "import { SimpleGrid } from '@mantine/core';",
+ "import { UiAnchor, UiCard } from '@pubkey-ui/core';",
+ "export function DemoFeatureAnchor() {",
+ "return (",
+ "",
+ "",
+ "Anchor with To",
+ "",
+ "Anchor without To",
+ "",
+ "Anchor without To",
+ "",
+ "",
+ ");",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./test/demo/demo-feature-anchor.tsx",
+ },
"demo-feature-back.tsx": {
"content": [
"import { UiBack, UiCard } from '@pubkey-ui/core';",
@@ -887,6 +908,7 @@ exports[`features generator should run successfully 1`] = `
"import { ReactNode } from 'react';",
"import { Link, Navigate, useLocation, useRoutes } from 'react-router-dom';",
"import { DemoFeatureAlerts } from './demo-feature-alerts';",
+ "import { DemoFeatureAnchor } from './demo-feature-anchor';",
"import { DemoFeatureBack } from './demo-feature-back';",
"import { DemoFeatureCard } from './demo-feature-card';",
"import { DemoFeatureCopy } from './demo-feature-copy';",
@@ -913,6 +935,7 @@ exports[`features generator should run successfully 1`] = `
"element: ReactNode;",
"}[] = [",
"{ path: 'alerts', label: 'Alerts', element: },",
+ "{ path: 'anchor', label: 'Anchor', element: },",
"{ path: 'back', label: 'Back', element: },",
"{ path: 'card', label: 'Card', element: },",
"{ path: 'copy', label: 'Copy', element: },",
diff --git a/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap b/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap
index 0744af2..c8573be 100644
--- a/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap
+++ b/packages/generators/src/generators/theme/__snapshots__/theme-generator.spec.ts.snap
@@ -204,6 +204,7 @@ exports[`theme generator should run successfully 1`] = `
"index.ts": {
"content": [
"export * from './ui-alert';",
+ "export * from './ui-anchor';",
"export * from './ui-back';",
"export * from './ui-card';",
"export * from './ui-container';",
@@ -307,6 +308,52 @@ exports[`theme generator should run successfully 1`] = `
},
"path": "./test-target/src/app/ui/ui-alert",
},
+ "ui-anchor": {
+ "children": {
+ "index.ts": {
+ "content": [
+ "export * from './ui-anchor';",
+ ],
+ "isBinary": false,
+ "path": "./test-target/src/app/ui/ui-anchor/index.ts",
+ },
+ "ui-anchor.tsx": {
+ "content": [
+ "import { Anchor, AnchorProps } from '@mantine/core';",
+ "import { ReactNode } from 'react';",
+ "import { Link } from 'react-router-dom';",
+ "export interface UiAnchorProps extends AnchorProps {",
+ "children: ReactNode;",
+ "href?: string;",
+ "to?: string;",
+ "target?: HTMLAnchorElement['target'];",
+ "}",
+ "export function UiAnchor({",
+ "children,",
+ "href,",
+ "target,",
+ "to,",
+ "...props",
+ "}: UiAnchorProps) {",
+ "return to ? (",
+ "",
+ "{children}",
+ "",
+ ") : href ? (",
+ "",
+ "{children}",
+ "",
+ ") : (",
+ "children",
+ ");",
+ "}",
+ ],
+ "isBinary": false,
+ "path": "./test-target/src/app/ui/ui-anchor/ui-anchor.tsx",
+ },
+ },
+ "path": "./test-target/src/app/ui/ui-anchor",
+ },
"ui-back": {
"children": {
"index.ts": {