-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicComponent.js
More file actions
46 lines (43 loc) · 1.39 KB
/
DynamicComponent.js
File metadata and controls
46 lines (43 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Teaser from "./HeroImageOnRight";
import Feature from "./Feature";
import FeaturedPosts from "./FeaturedPosts";
import Grid from "./Grid";
import Placeholder from "./Placeholder";
import PostsList from "./PostsList";
import Page from "./Page";
import BlogPost from "./BlogPost";
import HeroImageOnRight from "./HeroImageOnRight";
import Headline from "./Headline";
import ImageWithTextOnRight from "./ImageWithTextOnRight";
import TextWithImage from "./TextWithImage";
import CallToAction from "./CallToAction";
import ContactForm from "./ContactForm";
import Testimonial from "./Testimonial";
import Prose from "./Prose";
import Services from "./Services";
const Components = {
teaser: Teaser,
"layout-grid": Grid,
feature: Feature,
"featured-posts": FeaturedPosts,
page: Page,
post: BlogPost,
"selected-posts": PostsList,
"hero-image-on-right": HeroImageOnRight,
headline: Headline,
"image-with-text-on-right": ImageWithTextOnRight,
"text-with-image": TextWithImage,
"call-to-action": CallToAction,
"contact-form": ContactForm,
testimonial: Testimonial,
prose: Prose,
services: Services,
};
const DynamicComponent = ({ blok }) => {
if (typeof Components[blok.component] !== "undefined") {
const Component = Components[blok.component];
return <Component blok={blok} />;
}
return <Placeholder componentName={blok.component} />;
};
export default DynamicComponent;