Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PCC 792] Add file smart component field type #134

Merged
merged 3 commits into from
Dec 5, 2023
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
6 changes: 3 additions & 3 deletions packages/core/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export const SmartComponentMapZod = z.record(
fields: z.record(
z.string(),
z.object({
displayName: z.string().nullable().optional(),
required: z.boolean().nullable().optional(),
type: z.string().nullable(),
displayName: z.string(),
required: z.boolean(),
type: z.enum(["string", "number", "boolean", "date", "file"]),
}),
),
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SmartComponentMap } from "@pantheon-systems/pcc-react-sdk";
import LeadCapture from "./lead-capture";

export const serverSmartComponentMap = {
Expand All @@ -17,7 +18,7 @@ export const serverSmartComponentMap = {
},
},
},
};
} satisfies SmartComponentMap;

export const clientSmartComponentMap = {
LEAD_CAPTURE: {
Expand Down
4 changes: 2 additions & 2 deletions starters/vue-starter-ts/pages/articles/[id].vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import ArticlePreview from '../../components/article/ArticlePreview.vue';
import ArticleView from '../../components/article/ArticleView.vue';
import type { PantheonClientConfig } from '@pantheon-systems/pcc-vue-sdk';
import { type Article, type PantheonClientConfig } from '@pantheon-systems/pcc-vue-sdk';

const route = useRoute()
const config = useRuntimeConfig()
Expand All @@ -18,7 +18,7 @@ const pantheonConfig = {

const articleId = route.params.id

const { data: article, error } = await useFetch(`/api/articles/${articleId}`, {
const { data: article, error } = await useFetch<Article>(`/api/articles/${articleId}`, {
query: {
publishingLevel
}
Expand Down
3 changes: 2 additions & 1 deletion starters/vue-starter-ts/server/lib/pantheon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
PantheonClient,
PantheonClientConfig,
type SmartComponentMap,
} from "@pantheon-systems/pcc-vue-sdk";

const { PCC_SITE_ID, PCC_API_KEY } = process.env;
Expand Down Expand Up @@ -38,4 +39,4 @@ export const smartComponentMap = {
},
},
},
};
} satisfies SmartComponentMap;
Loading