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: header + welcome section #114

Merged
merged 25 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
def034f
chore: remove annoying styled plugin
gabitoesmiapodo Jun 12, 2024
3981df2
chore: remove some unused components
gabitoesmiapodo Jun 13, 2024
2fc0d9d
refactor: update and enhance several aspects from the CSS variables
gabitoesmiapodo Jun 13, 2024
7b8d357
refactor: remove InnerContainer as it's not needed for this particula…
gabitoesmiapodo Jun 13, 2024
93e98a3
feat: update header looks and main menu items
gabitoesmiapodo Jun 13, 2024
7fd7aba
feat: add basic examples component
gabitoesmiapodo Jun 13, 2024
e5290da
feat: add clouds component
gabitoesmiapodo Jun 13, 2024
2b6cc00
feat: add ghost component
gabitoesmiapodo Jun 13, 2024
142df1a
feat: add welcome section
gabitoesmiapodo Jun 13, 2024
f56f80f
refactor: update home
gabitoesmiapodo Jun 13, 2024
c7a15d2
refactor: main menu
gabitoesmiapodo Jun 13, 2024
04b52e6
chore: update db-ui-toolkit version
gabitoesmiapodo Jun 13, 2024
bd850d3
Merge branch 'main' into feat/#107-header-#108-welcome-section
gabitoesmiapodo Jun 13, 2024
9383ceb
refactor: move examples to a more appropriate folder
gabitoesmiapodo Jun 13, 2024
0aade01
refactor: move components to a less threatening and less confusing fo…
gabitoesmiapodo Jun 13, 2024
a80d49b
feat: add custom avatar
gabitoesmiapodo Jun 13, 2024
29375c1
feat: add secondary button
gabitoesmiapodo Jun 13, 2024
56b8882
chore: update theme for primary and secondary buttons
gabitoesmiapodo Jun 13, 2024
1dd0049
feat: add github and docs button for the welcome page
gabitoesmiapodo Jun 13, 2024
33502b2
feat: rename WelcomSection to Welcome, add text and buttons
gabitoesmiapodo Jun 13, 2024
1a688b4
refactor: welcome section buttons to use some common code
gabitoesmiapodo Jun 13, 2024
f94818f
feat: add github clone copy string thing
gabitoesmiapodo Jun 13, 2024
222c5de
fix: component overflowing issue
gabitoesmiapodo Jun 13, 2024
1e19420
fix: avatar typings
gabitoesmiapodo Jun 13, 2024
5abd8a3
fix: menu items constant type
gabitoesmiapodo Jun 14, 2024
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
20 changes: 20 additions & 0 deletions src/constants/menuItems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type MenuItem = {
href?: string
label: string
to?: string
}

export const menuItems = [
{
label: 'Home',
to: '/#top',
},
{
label: 'Documentation',
href: 'https://docs.dappboster.io',
},
{
label: 'Examples',
to: '/#examples',
},
] as MenuItem[]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type assertion may lead to false positives.

If there's no big issue, I would go with:

export const menuItems: MenuItems[] = [

15 changes: 9 additions & 6 deletions src/sharedComponents/ui/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ import { useTheme } from 'next-themes'
import { MainMenu } from '@/src/sharedComponents/ui/MainMenu'
import { ConnectWalletButton } from '@/src/sharedComponents/web3/Web3Provider'

/**
* Note: you can remove all the custom styles and just use the default Header
* component from db-ui-toolkit (or just create your own)
*/
const Wrapper = styled(BaseHeader)`
height: 48px;
margin-top: 48px;
height: var(--base-header-height);
padding-top: 14px;
position: relative;
z-index: 10;
`

const Inner = styled(InnerContainer)`
Expand Down Expand Up @@ -65,10 +71,7 @@ export const Header: React.FC<PropsWithChildren> = ({ ...restProps }) => {
</Start>
<Menu />
<End>
<SwitchThemeButton
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
theme={theme}
/>
<SwitchThemeButton onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

<ConnectWalletButton />
</End>
</Inner>
Expand Down
33 changes: 27 additions & 6 deletions src/sharedComponents/ui/MainMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import styled from 'styled-components'
import styled, { css } from 'styled-components'

import { Link } from '@tanstack/react-router'

import { menuItems } from '@/src/constants/menuItems'

const Wrapper = styled.nav`
align-items: center;
display: flex;
column-gap: calc(var(--base-gap) * 5);
height: 100%;
`

const Item = styled(Link)`
const LinkCSS = css`
color: var(--theme-main-menu-item-color);
font-size: 1.6rem;
font-weight: 500;
Expand All @@ -25,13 +27,32 @@ const Item = styled(Link)`
}
`

const Item = styled(Link)`
${LinkCSS}
`

const ExternalItem = styled.a`
${LinkCSS}
`

export const MainMenu = ({ ...restProps }) => {
return (
<Wrapper {...restProps}>
<Item to="/">Home</Item>
<Item to="/tokens">Tokens</Item>
<Item to="/about">About</Item>
<Item to="/contact">Contact</Item>
{menuItems.map(({ href, label, to }, index) => {
const key = `menuItem_${index}`

return to ? (
<Item key={key} to={to}>
{label}
</Item>
) : href ? (
<ExternalItem href={href} key={key} rel="noopener noreferrer" target="_blank">
{label}
</ExternalItem>
) : (
<></>
)
})}
</Wrapper>
)
}