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: page header component #854

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#854](https://github.com/alleslabs/celatone-frontend/pull/854) Create PageHeaderContainer component
- [#851](https://github.com/alleslabs/celatone-frontend/pull/851) Add amp validator list page
- [#848](https://github.com/alleslabs/celatone-frontend/pull/848) Change Initia's config to use the new chain IDs (mahalo-2, minimove-2, miniwasm-2)
- [#847](https://github.com/alleslabs/celatone-frontend/pull/847) Add amp proposal details page
Expand Down
7 changes: 1 addition & 6 deletions src/lib/components/PageContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import type { BoxProps } from "@chakra-ui/react";
import { Box } from "@chakra-ui/react";
import type { ReactNode } from "react";

interface PageContainerProps extends BoxProps {
children: ReactNode;
}

const PageContainer = ({ children, ...containerProps }: PageContainerProps) => (
const PageContainer = ({ children, ...containerProps }: BoxProps) => (
<Box
as="main"
p={{ base: "16px", md: "48px" }}
Expand Down
28 changes: 28 additions & 0 deletions src/lib/components/PageHeaderContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { FlexProps } from "@chakra-ui/react";
import { Flex } from "@chakra-ui/react";

const PageHeaderContainer = ({
children,
bgColor,
...containerProps
}: FlexProps) => (
<Flex
as="header"
direction="column"
gap={{ base: "24px", md: "32px" }}
px={{ base: "16px", md: "48px" }}
pt={{ base: "16px", md: "48px" }}
bgGradient={
bgColor
? {
md: `linear(to-b, ${bgColor}, transparent)`,
}
: undefined
}
{...containerProps}
>
{children}
</Flex>
);

export default PageHeaderContainer;
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ export const ValidatorTop = ({
totalVotingPower,
singleStakingDenom,
}: ValidatorTopProps) => (
<Flex
direction="column"
gap={5}
px={{ base: "16px", md: "48px" }}
pt={{ base: "16px", md: "48px" }}
bgGradient="linear(to-b, success.background, transparent)"
>
<>
<Breadcrumb
items={[
{
Expand Down Expand Up @@ -97,5 +91,5 @@ export const ValidatorTop = ({
/>
</Flex>
</Flex>
</Flex>
</>
);
13 changes: 8 additions & 5 deletions src/lib/pages/validator-details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { CustomTab } from "lib/components/CustomTab";
import { Loading } from "lib/components/Loading";
import PageContainer from "lib/components/PageContainer";
import PageHeaderContainer from "lib/components/PageHeaderContainer";
import { ErrorFetching, InvalidState } from "lib/components/state";
import { useAssetInfos } from "lib/services/assetService";
import { useValidatorData } from "lib/services/validatorService";
Expand Down Expand Up @@ -71,11 +72,13 @@ const ValidatorDetailsBody = ({

return (
<>
<ValidatorTop
info={data.info}
totalVotingPower={data.totalVotingPower}
singleStakingDenom={singleStakingDenom}
/>
<PageHeaderContainer bgColor="success.background">
<ValidatorTop
info={data.info}
totalVotingPower={data.totalVotingPower}
singleStakingDenom={singleStakingDenom}
/>
</PageHeaderContainer>
<PageContainer>
<Tabs
index={Object.values(TabIndex).indexOf(tab)}
Expand Down
11 changes: 3 additions & 8 deletions src/lib/pages/validators/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AmpEvent, track } from "lib/amplitude";
import { useGovConfig, useMobile } from "lib/app-provider";
import InputWithIcon from "lib/components/InputWithIcon";
import PageContainer from "lib/components/PageContainer";
import PageHeaderContainer from "lib/components/PageHeaderContainer";
import { Pagination } from "lib/components/pagination";
import { usePaginator } from "lib/components/pagination/usePaginator";
import { useDebounce } from "lib/hooks";
Expand Down Expand Up @@ -65,13 +66,7 @@ const Validators = () => {
const scrollComponentId = "validator-table-header";
return (
<>
<Flex
direction="column"
gap={{ base: "24px", md: "32px" }}
px={{ base: "16px", md: "48px" }}
pt={{ base: "16px", md: "48px" }}
bgGradient={{ md: "linear(to-b, success.background, transparent)" }}
>
<PageHeaderContainer bgColor="success.background">
<Flex direction="column" gap={1}>
<Heading as="h5" variant="h5" color="text.main" fontWeight={600}>
Validators
Expand Down Expand Up @@ -115,7 +110,7 @@ const Validators = () => {
amptrackSection="validator-list-search"
/>
</Flex>
</Flex>
</PageHeaderContainer>
<PageContainer>
<ValidatorsTable
data={data}
Expand Down
Loading