Skip to content

Commit

Permalink
Improve breadcrumb navigation behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
iaincollins committed Sep 5, 2024
1 parent 1c56eef commit 6c6dd93
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 14 deletions.
5 changes: 0 additions & 5 deletions components/tab-options.js

This file was deleted.

47 changes: 47 additions & 0 deletions components/tab-options/commodity-filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { useState, useEffect } from 'react'

export default () => {
const [lastUpdatedFilter, setLastUpdatedFilter] = useState()
const [fleetCarrierFilter, setFleetCarrierFilter] = useState()
const [minimumAmountFilter, setMinimumAmountFilter] = useState()

useEffect(() => {
// window.localStorage.setItem('item', 'value')
// window.localStorage.removeItem('color-settings')
// window.localStorage.getItem('color-settings')
}, [])

return null

return (
<div className='tab-tab_options'>
<form>
<label>
Updated
<select name='selector'>
<option>In the last hour</option>
<option>Today</option>
<option>In the last week</option>
<option>In the last month</option>
<option>In the last 3 months</option>
<option>Anytime</option>
</select>
</label>

<label>
Fleet Carriers
<select name='selector'>
<option>Include</option>
<option>Exclude</option>
<option>Only</option>
</select>
</label>

<label>
Min. Quantity
<input name='text-input' type='type' size='6' placeholder='None' />
</label>
</form>
</div>
)
}
26 changes: 26 additions & 0 deletions components/tab-options/tab-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export default function TabOptions() {
return (
<div className='tab-tab_options'>
<form>
<label>
<input name='check-input' type='checkbox' />
Checkbox Option
</label>

<label>
Text Option
<input name='text-input' type='type' size='10' />
</label>

<label>
Select Option
<select name='selector'>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</label>
</form>
</div>
)
}
1 change: 1 addition & 0 deletions css/components/breadcrumbs.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
text-transform: uppercase;
font-family: 'Jura';
font-weight: bold;
pointer-events: all;
}

.breadcrumbs li a {
Expand Down
24 changes: 23 additions & 1 deletion css/components/tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,30 @@
.tab-tab_options {
background: var(--color-primary);
color: var(--color-text-inverted);
padding: .25rem 0.5rem;
padding: .5rem;
font-family: "Jura", sans-serif;
font-weight: bold;
font-size: 1rem;
overflow: auto;
}

.tab-tab_options form label {
margin-right: 1.5rem;
}

.tab-tab_options form input,
.tab-tab_options form select {
background: var(--color-primary);
border-color: rgb(0,0,0, .25);
color: var(--color-text-inverted);
border-style: solid;
border-width: .1rem;
border-radius: 0.2rem;
padding: .25rem;
margin-left: .5rem;
}

.tab-tab_options form input[type="checkbox"] {
margin-left: 0;
margin-right: .5rem;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ardent-www",
"version": "0.41.0",
"version": "0.41.1",
"description": "Ardent Industry",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions pages/commodity/[commodity-name]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState, useEffect } from 'react'
import { useRouter } from 'next/router'
import Link from 'next/link'
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs'
import TabOptions from 'components/tab-options'
import CommodityFilterTabOptions from 'components/tab-options/commodity-filter'
import Layout from 'components/layout'
import CommodityImportOrders from 'components/commodity-import-orders'
import CommodityExportOrders from 'components/commodity-export-orders'
Expand Down Expand Up @@ -85,7 +85,9 @@ export default () => {

return (
<Layout loading={commodity === undefined || imports === undefined}>
<ul className='breadcrumbs fx__fade-in'>
<ul className='breadcrumbs fx__fade-in' onClick={(e) => {
if (e.target.tagName == 'LI') e.target.children[0].click()
}}>
<li><Link href='/'>Home</Link></li>
<li><Link href='/commodities'>Commodities</Link></li>
</ul>
Expand Down Expand Up @@ -198,9 +200,7 @@ export default () => {
<TabList>
<Tab>Importers</Tab>
<Tab>Exporters</Tab>
<TabOptions>
Some tab options
</TabOptions>
<CommodityFilterTabOptions/>
</TabList>
<TabPanel>
{!imports && <div className='loading-bar loading-bar--tab' />}
Expand Down
6 changes: 4 additions & 2 deletions pages/system/[system-name]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ export default () => {

return (
<Layout loading={system === undefined}>
<ul className='breadcrumbs fx__fade-in'>
<ul className='breadcrumbs fx__fade-in' onClick={(e) => {
if (e.target.tagName == 'LI') e.target.children[0].click()
}}>
<li><Link href='/'>Home</Link></li>
<li><Link href='/commodities'>Systems</Link></li>
<li><Link href='/'>Systems</Link></li>
</ul>
{system === null && <><h2>Error</h2><p className='clear'>System not found</p></>}
{system &&
Expand Down

0 comments on commit 6c6dd93

Please sign in to comment.