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

feat: Add components page #17

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
24 changes: 24 additions & 0 deletions template/src/component/component-list/ComponentListPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Button as HipoButton} from "@hipo/react-ui-toolkit";

import PageContent from "../page/content/PageContent";
import Page from "../page/Page";

function ComponentListPage() {
return (
<Page title={"Components Page"}>
<PageContent>
<div>
yigiterdev marked this conversation as resolved.
Show resolved Hide resolved
<h1>{"Button"}</h1>

<HipoButton onClick={onClickButton}>{"Click"}</HipoButton>
</div>
</PageContent>
</Page>
);

function onClickButton() {
yigiterdev marked this conversation as resolved.
Show resolved Hide resolved
console.log("Clicked!");
}
}

export default ComponentListPage;
16 changes: 16 additions & 0 deletions template/src/core/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ import ROUTES from "../route/routes";
import {AppContextProvider} from "./AppContext";
import HomePage from "../../home/HomePage";
import NotFoundPage from "../route/not-found-page/NotFoundPage";
import {isOnProductionEnv} from "../util/environment/environmentUtils";

const HelpPage = lazy(
() => import(/* webpackChunkName: "help-page" */ "../../help/HelpPage")
);
const ComponentListPage = lazy(
() =>
import(
/* webpackChunkName: "component-list-page" */ "../../component/component-list/ComponentListPage"
)
);

function App() {
return (
Expand All @@ -31,6 +38,15 @@ function App() {
}
/>

{
/**
* Development and testing only routes
*/
!isOnProductionEnv() && (
<Route path={ROUTES.COMPONENT_LIST} element={<ComponentListPage />} />
)
}

<Route path={"*"} element={<NotFoundPage />} />
</Routes>
</AppContextProvider>
Expand Down
4 changes: 3 additions & 1 deletion template/src/core/route/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ const BASE_ROOT = "/" as const;
const ROUTES = {
HOME: BASE_ROOT,
HELP: `${BASE_ROOT}help`,
ACCOUNT: `${BASE_ROOT}account`
ACCOUNT: `${BASE_ROOT}account`,

COMPONENT_LIST: `/components`
} as const;

export default ROUTES;
13 changes: 13 additions & 0 deletions template/src/core/util/environment/environmentUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function isOnDevEnv() {
return process.env.REACT_APP_BUILD_ENVIRONMENT === "dev";
}

function isOnStagingEnv() {
return process.env.REACT_APP_BUILD_ENVIRONMENT === "staging";
}

function isOnProductionEnv() {
return process.env.REACT_APP_BUILD_ENVIRONMENT === "production";
}

export {isOnDevEnv, isOnStagingEnv, isOnProductionEnv};