Skip to content

Commit

Permalink
refactor the home and search header
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed Aug 31, 2023
1 parent 1fabb30 commit bcdca05
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 66 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { GradientText, Heading, Stack } from '@kadena/react-ui';

import { mostPopularWrapper } from './style.css';
import { StyledHeader, SubHeader, Wrapper } from './styles';
import {
headerClass,
mostPopularWrapper,
subheaderClass,
wrapperClass,
} from './style.css';

import { MostPopular } from '@/components/MostPopular';
import { IMostPopularPage } from '@/types/MostPopularData';
Expand All @@ -13,8 +17,8 @@ interface IProps {

export const HomeHeader: FC<IProps> = ({ popularPages }) => {
return (
<StyledHeader>
<Wrapper>
<header className={headerClass}>
<div className={wrapperClass}>
<Heading as="h1" variant="h2">
Kadena
</Heading>
Expand All @@ -23,17 +27,17 @@ export const HomeHeader: FC<IProps> = ({ popularPages }) => {
<Heading as="h2" variant="h4">
Build your <GradientText>own</GradientText> Internet
</Heading>
<SubHeader>
<span className={subheaderClass}>
Explore our guides and examples to build on Kadena
</SubHeader>
</span>
</Stack>
{popularPages.length > 0 && (
<div className={mostPopularWrapper}>
<MostPopular pages={popularPages} title="Most viewed docs" />
</div>
)}
</Stack>
</Wrapper>
</StyledHeader>
</div>
</header>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GradientText, Heading, Stack } from '@kadena/react-ui';

import { StyledHeader, SubHeader, Wrapper } from './styles';
import { headerClass, subheaderClass, wrapperClass } from './style.css';

import React, { FC, ReactNode } from 'react';

Expand All @@ -10,19 +10,21 @@ interface IProps {

export const SearchHeader: FC<IProps> = ({ children }) => {
return (
<StyledHeader>
<Wrapper>
<header className={headerClass}>
<div className={wrapperClass}>
<Heading as="h1" variant="h2">
Search spaces
</Heading>
<Stack direction="column" gap="$2xs">
<Heading as="h2" variant="h4">
Traditional or the <GradientText>new</GradientText> way
</Heading>
<SubHeader>Explore our content across spaces</SubHeader>
<span className={subheaderClass}>
Explore our content across spaces
</span>
{children}
</Stack>
</Wrapper>
</StyledHeader>
</div>
</header>
);
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { sprinkles } from '@kadena/react-ui/theme';
import { darkThemeClass, sprinkles } from '@kadena/react-ui/theme';

import { $$pageWidth } from '@/components/Layout/global.css';
import { style } from '@vanilla-extract/css';

export const mostPopularWrapper = style([
Expand All @@ -21,3 +22,59 @@ export const mostPopularWrapper = style([
},
},
]);

export const headerClass = style([
sprinkles({
position: 'relative',
}),
{
gridArea: 'pageheader',
zIndex: 2,
selectors: {
'&::before': {
content: '',
position: 'absolute',
inset: 0,
background: 'url("/assets/bg-horizontal.png")',
backgroundRepeat: 'no-repeat',
backgroundPositionX: 'center',
backgroundPositionY: '0%',
transform: 'scale(-1, -1)',
},
},
},
]);

export const wrapperClass = style([
sprinkles({
position: 'relative',
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-start',
width: '100%',
paddingTop: '$20',
paddingRight: '$12',
paddingBottom: '$10',
paddingLeft: '$4',
marginX: 'auto',
marginBottom: '$16',
}),
{
maxWidth: $$pageWidth,
backgroundColor: 'rgba(250,250,250, .8)',
},
]);

export const subheaderClass = style([
sprinkles({
color: '$neutral3',
fontSize: '$xl',
}),
{
selectors: {
[`${darkThemeClass} &`]: {
color: '$neutral4',
},
},
},
]);

This file was deleted.

0 comments on commit bcdca05

Please sign in to comment.