Skip to content

Commit

Permalink
Merge pull request #458 from StampyAI/stampy-redesign-424-a
Browse files Browse the repository at this point in the history
mobile header on all pages.
  • Loading branch information
buddy-web3 authored Feb 29, 2024
2 parents e841ad0 + 6a8b351 commit a8d6286
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion app/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const Button = ({children, action, tooltip, className}: ButtonProps) => {
return (
<button className={classes} onClick={action} data-tooltip={tooltip}>
{children}
{icon && icon}
</button>
)
}
Expand Down
3 changes: 1 addition & 2 deletions app/components/Nav/Mobile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const MobileNav = ({toc, categories}: NavProps) => {
const toggleSearch = () => {
setShowSearch(!showSearch)
}
console.log('toc', toc)
return (
<header className="top-header">
{!showArticles && (
Expand Down Expand Up @@ -60,12 +59,12 @@ export const MobileNav = ({toc, categories}: NavProps) => {
<Button
action={() => setShowArticles(!showArticles)}
className="secondary full-width space-between"
icon={<CarrotLarge />}
>
<p className={'composite-elements small'}>
<OpenBookIcon className={'icon-margin'} />
Articles
</p>
<CarrotLarge />
</Button>
<Button action="https://xkcd.com/285/" className="secondary full-width flex-start">
<p className={'composite-elements small'}>
Expand Down
9 changes: 5 additions & 4 deletions app/components/Nav/Mobile/navMobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@
.mobile-searchbar > * .search-box.expandable {
width: 100%;
}
.container-search-results {
height: 50vh !important;
width: 100% !important;
position: inherit !important;
.container-search-results-mobile {
height: 50vh;
width: 82vw;
position: inherit;
margin-top: var(--spacing-8);
overflow: scroll;
}
}
12 changes: 9 additions & 3 deletions app/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@ import {useOutletContext} from '@remix-run/react'
import type {Context} from '~/root'
import Footer from '~/components/Footer'
import Nav from '~/components/Nav'
import MobileNav from '~/components/Nav/Mobile'
import {useTags} from '~/hooks/useCachedObjects'
import useToC from '~/hooks/useToC'

import useIsMobile from '~/hooks/isMobile'
const Page = ({children, modal}: {children: ReactNode; modal?: boolean}) => {
const {toc} = useToC()
const {items: tags} = useTags()
const {embed} = useOutletContext<Context>() || {}

const isMobile = useIsMobile()
return (
<>
{!modal && <Nav toc={toc} categories={tags} />}
{!modal &&
(isMobile ? (
<MobileNav toc={toc} categories={tags} />
) : (
<Nav toc={toc} categories={tags} />
))}
{children}

{!embed && !modal && <Footer />}
Expand Down
4 changes: 2 additions & 2 deletions app/components/SearchResults/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export const SearchResults = ({results}: {results: SearchResultsProps[]}) => {
const noResults = results.length === 0
if (noResults) {
return (
<div className="container-search-results bordered col-5">
<div className="container-search-results bordered col-5 container-search-results-mobile">
<div className="search-result">No results found</div>
</div>
)
}

return (
<div className="container-search-results bordered col-5">
<div className="container-search-results bordered col-5 container-search-results-mobile">
{results.map((result, i) => (
<Link key={i} className="search-result" to={result.url}>
<Paper />
Expand Down

0 comments on commit a8d6286

Please sign in to comment.