I am using the frontity-chakra-theme and trying to modify the existing homepage but unfortunately, when I added a new component to it, its starts appearing across all other pages wp-pages which i have loaded ast he menu.
my custom component code:
import { Box, PseudoBox, SimpleGrid } from "@chakra-ui/core";
import React from "react";
import { connect } from "frontity";
const ServicesBox = props => (
<Box
pos="relative"
bg="#3d3b3b"
py={{ base: "32px", lg: "40px" }}
{...props}
/>
);
const ServiceSectionGroup = props => (
<SimpleGrid
columns={{ base: 1, md: 1 }}
maxWidth="1150px"
mx="auto"
p = {6}
width="90%"
{...props}
/>
);
const property = {
h1: "“From social media agencyto Super Bowl powerhouse”-AdWeek"
}
const ServicesContainer = props => (
<Box
color="#fff"
as="h1"
width="85%"
textTransform="uppercase"
alignItems="center"
textAlign="center"
fontSize="2.5em"
{...props}
/>
);
const ServicesBoxSection = ({ state }) => (
<ServicesBox alignSelf="flex-end">
<ServiceSectionGroup>
<ServicesContainer>
{property.h1}
</ServicesContainer>
</ServiceSectionGroup>
</ServicesBox>
);
export default connect(ServicesBoxSection);
My Index page source code
import { Box, CSSReset, theme, ThemeProvider } from "@chakra-ui/core";
import { connect, Head } from "frontity";
import React from "react";
import Archive from "./archive";
import Footer from "./footer";
import Header from "./header";
import Loading from "./loading";
import Page404 from "./page404";
import Post from "./post/post";
import SearchResults from "./search";
import Title from "./title";
import FontFace from "./styles/font-face";
import ServicesBoxSection from "./services/services.js";
// Theme is the root React component of our theme. The one we will export
// in roots.
const Theme = ({ state, libraries }) => {
// Get information about the current URL.
const data = state.source.get(state.router.link);
const parse = libraries.source.parse(state.router.link);
// Check if the url is a search type
const isSearch = Boolean(parse.query["s"]);
return (
<ThemeProvider
theme={{
...theme,
fonts: {
...theme.fonts,
heading: "Montserrat, sans-serif"
},
colors: { ...theme.colors, ...state.theme.colors }
}}
>
<FontFace />
<CSSReset />
<Title />
<Head>
<meta name="description" content={state.frontity.description} />
<html lang="en" />
</Head>
<Header />
<ServicesBoxSection />
<Box
as="main"
mt={{ base: "40px", md: "70px" }}
minH="calc(100vh - 320px)"
>
{(data.isFetching && <Loading />) ||
(isSearch && <SearchResults />) ||
// (data.isArchive && <Archive />) ||
(data.isPostType && <Post />) ||
(data.is404 && <Page404 />)}
</Box>
<Footer />
</ThemeProvider>
);
};
export default connect(Theme);
I commented the Archive section and use my own section but when I apply into this code like:
<Box
as="main"
mt={{ base: "40px", md: "70px" }}
minH="calc(100vh - 320px)"
>
{(data.isFetching && <Loading />) ||
(isSearch && <SearchResults />) ||
// (data.isArchive && <Archive />) ||
(<ServicesBoxSection />) ||
(data.isPostType && <Post />) ||
(data.is404 && <Page404 />)}
</Box>
It appears as required but when adding a section below my custom component ServicesBoxSection
then there nothing added, i tried in this way:
<Box
as="main"
mt={{ base: "40px", md: "70px" }}
minH="calc(100vh - 320px)"
>
{(data.isFetching && <Loading />) ||
(isSearch && <SearchResults />) ||
(data.isArchive && <Archive />) ||
(data.isPostType && <Post />) ||
<ServicesBoxSection /> ||
(data.is404 && <Page404 />)}
</Box>
Then this code do not add my custom component.
Question is:
Do I have to create my custom page and then point this route “/” to my custom page or can I modify the one which is already there?