Skip to content

Commit

Permalink
more type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephiescastle committed Jun 25, 2024
1 parent 03dbb80 commit 6b88c05
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 30 deletions.
11 changes: 4 additions & 7 deletions packages/vue/dist/packages/vue/src/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export interface ImageObject {
}
export interface ImageBlock extends BlockData, ImageObject {
}
export interface TopicsForDisplay {
title: string;
url: string;
}
export interface ElasticSearchPage {
id: string | number;
content_type: string;
Expand Down Expand Up @@ -92,12 +88,9 @@ export interface RelatedLinkObject {
export interface PageResponse {
__typename: string;
contentType: string;
body?: Streamfield;
breadcrumb?: string;
url?: string;
}
export interface Streamfield extends Partial<BlockData> {
}
export type Explorer1Theme = 'defaultTheme' | 'ThemeInternal' | 'ThemeEdu';
export interface Attributes {
[name: string]: string;
Expand All @@ -106,3 +99,7 @@ export interface AuthorObject {
name: string;
organization: string;
}
export interface Topic {
title: string;
url: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export const variants: Variants = {
fluid: '-fluid'
}
interface BlockData {
export interface StreamfieldBlockData {
blockType: string
id: string
fullBleed: boolean
Expand Down Expand Up @@ -285,7 +285,7 @@ export default defineComponent({
validator: (prop: string): boolean => Object.keys(variants).includes(prop)
},
data: {
type: Array as PropType<BlockData[]>,
type: Array as PropType<StreamfieldBlockData[]>,
required: false
}
},
Expand All @@ -300,7 +300,7 @@ export default defineComponent({
seamlessText(index: number): boolean {
const nextIndex = index + 1
if (this.data && this.data[nextIndex]) {
const nextBlock = this.data[nextIndex] as BlockData
const nextBlock = this.data[nextIndex] as StreamfieldBlockData
const nextBlockType = nextBlock.blockType
if (nextBlockType === 'InlineImageBlock' || nextBlockType === 'RichTextBlock') {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,10 @@
import { defineComponent, type PropType } from 'vue'
import { mapStores } from 'pinia'
import { useThemeStore } from '../../store/theme'
import type { Topic } from './../../interfaces'
import BaseLink from './../BaseLink/BaseLink.vue'
import BaseHeading from './../BaseHeading/BaseHeading.vue'
interface Topic {
title: string
url: string
}
export default defineComponent({
name: 'DetailHeadline',
components: {
Expand Down
16 changes: 5 additions & 11 deletions packages/vue/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface BreadcrumbPathObject {
export interface BlockData {
blockType: string
}

export interface ImageSrcObject {
url: string
width: number
Expand Down Expand Up @@ -41,12 +40,6 @@ export interface ImageObject {

export interface ImageBlock extends BlockData, ImageObject {}

export interface TopicsForDisplay {
title: string
url: string
}
;[]

export interface ElasticSearchPage {
id: string | number
content_type: string
Expand Down Expand Up @@ -99,14 +92,10 @@ export interface RelatedLinkObject {
export interface PageResponse {
__typename: string
contentType: string
body?: Streamfield
breadcrumb?: string
url?: string
}

export interface Streamfield extends Partial<BlockData> {}
;[]

export type Explorer1Theme = 'defaultTheme' | 'ThemeInternal' | 'ThemeEdu'

export interface Attributes {
Expand All @@ -117,3 +106,8 @@ export interface AuthorObject {
name: string
organization: string
}

export interface Topic {
title: string
url: string
}
10 changes: 6 additions & 4 deletions packages/vue/src/templates/edu/PageEduNewsDetail.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<script setup lang="ts">
import { computed } from 'vue'
import type { StreamfieldBlockData } from '../../components/BlockStreamfield/BlockStreamfield.vue'
import type {
AuthorObject,
ImageObject,
PageResponse,
RelatedLinkObject,
TopicsForDisplay,
Topic,
ThumbnailObject
} from './../../interfaces'
import isEmpty from 'lodash/isEmpty'
interface PageEduNewsDetail extends PageResponse {
interface PageEduNewsDetailObject extends PageResponse {
heroImage: ImageObject
thumbnailImage: ThumbnailObject
heroPosition: string
Expand All @@ -19,15 +20,16 @@ interface PageEduNewsDetail extends PageResponse {
firstPublishedAt: string
lastPublishedAt: string
title: string
getTopicsForDisplay: TopicsForDisplay
getTopicsForDisplay: Topic[]
summary: string
topper: string
author: AuthorObject
relatedLinks: RelatedLinkObject[]
body: StreamfieldBlockData[]
}
interface PageEduNewsDetailProps {
data: PageEduNewsDetail
data: PageEduNewsDetailObject
}
// define props
Expand Down

0 comments on commit 6b88c05

Please sign in to comment.