-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from ffw-us/feature/vercel-content-links
Implement vercel content links with contentful content source maps.
- Loading branch information
Showing
21 changed files
with
1,672 additions
and
1,468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TopicBusinessInfo } from './topic-business-info'; |
40 changes: 40 additions & 0 deletions
40
components/topic-business-info/topic-business-info-client.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use client'; | ||
|
||
import { ResultOf } from 'gql.tada'; | ||
|
||
import { getImageChildProps } from '#/components/image-ctf'; | ||
import { RichTextCtf } from '#/components/rich-text-ctf'; | ||
import { TopicBusinessInfo } from '#/components/ui/topic-business-info'; | ||
|
||
import { useComponentPreview } from '../hooks/use-component-preview'; | ||
import { ComponentTopicBusinessInfoFieldsFragment } from './topic-business-info'; | ||
|
||
export const TopicBusinessInfoClient: React.FC<{ | ||
data: ResultOf<typeof ComponentTopicBusinessInfoFieldsFragment>; | ||
}> = (props) => { | ||
const { data: originalData } = props; | ||
const { data, addAttributes } = useComponentPreview<typeof originalData>(originalData); | ||
|
||
return ( | ||
<TopicBusinessInfo | ||
name={data.name} | ||
shortDescription={data.shortDescription} | ||
body={ | ||
data.body && ( | ||
<div {...addAttributes('bodyText')}> | ||
<RichTextCtf {...data.body} /> | ||
</div> | ||
) | ||
} | ||
featuredImage={ | ||
data.featuredImage && | ||
getImageChildProps({ | ||
data: data.featuredImage, | ||
sizes: '100vw', | ||
priority: true, | ||
}) | ||
} | ||
addAttributes={addAttributes} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { FragmentOf, graphql, readFragment } from 'gql.tada'; | ||
|
||
import { ComponentTopicPersonFieldsFragment } from '#/components/topic-person/topic-person'; | ||
|
||
import { AssetFieldsFragment } from '../asset-ctf'; | ||
import { TopicBusinessInfoClient } from './topic-business-info-client'; | ||
|
||
export const ComponentTopicBusinessInfoFieldsFragment = graphql( | ||
` | ||
fragment ComponentTopicBusinessInfo on TopicBusinessInfo { | ||
__typename | ||
sys { | ||
id | ||
} | ||
name | ||
shortDescription | ||
body { | ||
json | ||
links { | ||
entries { | ||
block { | ||
...ComponentTopicPerson | ||
} | ||
} | ||
} | ||
} | ||
featuredImage { | ||
...AssetFields | ||
} | ||
} | ||
`, | ||
[AssetFieldsFragment, ComponentTopicPersonFieldsFragment] | ||
); | ||
|
||
export type TopicBusinessInfoProps = { | ||
data: FragmentOf<typeof ComponentTopicBusinessInfoFieldsFragment>; | ||
}; | ||
|
||
export const TopicBusinessInfo: React.FC<TopicBusinessInfoProps> = (props) => { | ||
const data = readFragment(ComponentTopicBusinessInfoFieldsFragment, props.data); | ||
return <TopicBusinessInfoClient data={data} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TopicPerson } from './topic-person'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use client'; | ||
|
||
import { ResultOf } from 'gql.tada'; | ||
|
||
import { getImageChildProps } from '#/components/image-ctf'; | ||
import { RichTextCtf } from '#/components/rich-text-ctf'; | ||
import { TopicPerson } from '#/components/ui/topic-person'; | ||
|
||
import { useComponentPreview } from '../hooks/use-component-preview'; | ||
import { ComponentTopicPersonFieldsFragment } from '././topic-person'; | ||
|
||
export const TopicPersonClient: React.FC<{ | ||
data: ResultOf<typeof ComponentTopicPersonFieldsFragment>; | ||
}> = (props) => { | ||
const { data: originalData } = props; | ||
const { data, addAttributes } = useComponentPreview<typeof originalData>(originalData); | ||
|
||
return ( | ||
<TopicPerson | ||
name={data.name} | ||
bio={ | ||
data.bio && ( | ||
<div {...addAttributes('bodyText')}> | ||
<RichTextCtf {...data.bio} /> | ||
</div> | ||
) | ||
} | ||
avatar={ | ||
data.avatar && | ||
getImageChildProps({ | ||
data: data.avatar, | ||
}) | ||
} | ||
website={data.website} | ||
location={data.location} | ||
cardStyle={data.cardStyle} | ||
addAttributes={addAttributes} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FragmentOf, graphql, readFragment } from 'gql.tada'; | ||
|
||
import { AssetFieldsFragment } from '../asset-ctf'; | ||
import { TopicPersonClient } from './topic-person-client'; | ||
|
||
export const ComponentTopicPersonFieldsFragment = graphql( | ||
` | ||
fragment ComponentTopicPerson on TopicPerson { | ||
__typename | ||
sys { | ||
id | ||
} | ||
name | ||
website | ||
location | ||
cardStyle | ||
bio { | ||
json | ||
} | ||
avatar { | ||
...AssetFields | ||
} | ||
} | ||
`, | ||
[AssetFieldsFragment] | ||
); | ||
|
||
export type TopicBusinessInfoProps = { | ||
data: FragmentOf<typeof ComponentTopicPersonFieldsFragment>; | ||
}; | ||
|
||
export const TopicPerson: React.FC<TopicBusinessInfoProps> = (props) => { | ||
const data = readFragment(ComponentTopicPersonFieldsFragment, props.data); | ||
return <TopicPersonClient data={data} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './topic-business-info'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { Image, ImageProps } from '#/components/ui/image'; | ||
|
||
export interface TopicBusinessInfoProps { | ||
name: string | null; | ||
shortDescription?: string | null; | ||
body?: ReactNode; | ||
featuredImage?: ImageProps | null; | ||
addAttributes?: (name: string) => object | null; | ||
} | ||
|
||
export const TopicBusinessInfo = ({ | ||
name, | ||
shortDescription, | ||
body, | ||
featuredImage, | ||
addAttributes = () => ({}), | ||
}: TopicBusinessInfoProps) => { | ||
return ( | ||
<div className="flex justify-center py-12"> | ||
<div className="max-w-6xl px-5"> | ||
{featuredImage && ( | ||
<div className="overflow-hidden rounded-lg shadow-lg"> | ||
<Image {...addAttributes('image')} {...featuredImage} alt={featuredImage.alt} /> | ||
</div> | ||
)} | ||
|
||
<div className="py-6"> | ||
<h2 className="text-3xl">{name}</h2> | ||
{shortDescription && <div className="pt-6">{shortDescription}</div>} | ||
{body && <div className="pt-6">{body}</div>} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './topic-person'; |
Oops, something went wrong.