responsive filter bar

This commit is contained in:
Víctor Losada Hernández
2026-09-09 20:28:40 +02:00
parent c4a41562f0
commit 4e5480b5dd
2 changed files with 225 additions and 190 deletions
@@ -181,6 +181,7 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
if(filterTags?.length == 0) return; if(filterTags?.length == 0) return;
return ( return (
<div className='tags-container'> <div className='tags-container'>
Tags:
{_.map(filterTags, (tag, idx)=>{ {_.map(filterTags, (tag, idx)=>{
const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/); const matches = tag.match(/^(?:([^:]+):)?([^:]+)$/);
return ( return (
@@ -207,7 +208,6 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
{renderSortOption('Updated Date', 'updated')} {renderSortOption('Updated Date', 'updated')}
{renderSortOption('Views', 'views')} {renderSortOption('Views', 'views')}
{/* {renderSortOption('Latest', 'latest')} */} {/* {renderSortOption('Latest', 'latest')} */}
{renderFilterOption()}
</div> </div>
); );
}; };
@@ -290,6 +290,7 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
const renderLayoutModeOptions = ()=>{ const renderLayoutModeOptions = ()=>{
return ( return (
<div className='layout-container'> <div className='layout-container'>
View:
<div className='layout-option' title='grid'> <div className='layout-option' title='grid'>
<label> <label>
<input name='layout-mode' type='radio' onChange={(e)=>handleLayoutChange(e, 'grid')} checked={layoutMode === 'grid'} /> <input name='layout-mode' type='radio' onChange={(e)=>handleLayoutChange(e, 'grid')} checked={layoutMode === 'grid'} />
@@ -312,12 +313,24 @@ const ListPage = ({ brewCollection = [{ title: '', class: '', brews: [] }], navI
); );
}; };
const renderNav = () =>{
return (
<div className="listPageNav">
{renderSortOptions()}
{renderFilterOption()}
{renderTagsOptions()}
{renderLayoutModeOptions()}
</div>
);
}
return ( return (
<div className='listPage sitePage'> <div className='listPage sitePage'>
{navItems} {navItems}
{renderSortOptions()}
{renderTagsOptions()} {renderNav()}
{renderLayoutModeOptions()}
<div className='content V3'> <div className='content V3'>
<div className='brewCollection'>{renderBrewCollection(brewCollection)}</div> <div className='brewCollection'>{renderBrewCollection(brewCollection)}</div>
@@ -32,23 +32,30 @@
h1 { h1 {
margin-bottom: 20px; margin-bottom: 20px;
font-size: 25px; font-size: 25px;
color : #DDDDDD; color: #dddddd;
&.active::before, &.inactive::before { &.active::before,
&.inactive::before {
padding-right: 0.5em; padding-right: 0.5em;
font-family: 'Font Awesome 6 Free'; font-family: 'Font Awesome 6 Free';
font-size: 0.6cm; font-size: 0.6cm;
font-weight: 900; font-weight: 900;
} }
&.active { color : white; } &.active {
&.active::before { content : '\f107'; } color: white;
&.inactive::before { content : '\f105'; } }
&.active::before {
content: '\f107';
}
&.inactive::before {
content: '\f105';
}
}
h1:hover {
cursor: pointer;
} }
h1:hover { cursor : pointer; }
.brewGroup { .brewGroup {
&.grid { &.grid {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@@ -57,7 +64,6 @@
min-width: 200px; min-width: 200px;
} }
&.list { &.list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -69,16 +75,38 @@
column-gap: 40px; column-gap: 40px;
justify-content: center; justify-content: center;
h1 { position : absolute; } h1 {
position: absolute;
}
}
} }
} }
} }
.listPageNav {
position: relative;
width: 100%;
height: fit-content;
display: flex;
flex-wrap: wrap;
align-items:center;
justify-content: center;
background: #555;
column-gap: 20px;
row-gap: 10px;
border-top: 1px solid #666;
border-bottom: 1px solid #666;
font-family: 'Open Sans', sans-serif;
color: white;
row-rule: 1px solid #666;
> div {
width: fit-content;
padding-inline: 10px;
height:30px;
} }
.sort-container { .sort-container {
position : sticky;
top : 0;
left : 0;
z-index: 1; z-index: 1;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@@ -86,16 +114,10 @@
column-gap: 15px; column-gap: 15px;
align-items: baseline; align-items: baseline;
justify-content: center; justify-content: center;
width : 100%;
height : 30px;
font-family : 'Open Sans', sans-serif;
color : white;
text-align: center; text-align: center;
background-color : #555555;
border-top : 1px solid #666666;
border-bottom : 1px solid #666666;
h6 { h6 {
font-family : 'Open Sans', sans-serif;
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
@@ -105,41 +127,46 @@
align-items: center; align-items: center;
height: 100%; height: 100%;
padding: 0 8px; padding: 0 8px;
color : #CCCCCC; color: #cccccc;
&:hover { background-color : #444444; } &:hover {
background-color: #444444;
}
&.active { &.active {
font-weight: bold; font-weight: bold;
color : #DDDDDD; color: #dddddd;
background-color: #333333; background-color: #333333;
button { button {
height: 100%; height: 100%;
font-weight: 800; font-weight: 800;
color: white; color: white;
& + .sortDir { padding-left : 5px; } & + .sortDir {
padding-left: 5px;
}
}
} }
} }
}
.filter-option {
margin-left : 20px;
font-size : 11px;
background-color : transparent !important;
i { padding-right : 5px; }
}
button { button {
padding: 0; padding: 0;
font-family : 'Open Sans', sans-serif;
font-size: 11px; font-size: 11px;
font-weight: normal; font-weight: normal;
color : #CCCCCC; color: #cccccc;
text-transform: uppercase; text-transform: uppercase;
background-color: transparent; background-color: transparent;
} }
}
.filter-option {
display: grid;
place-items: center;
font-size: 11px;
background-color: transparent !important;
i {
padding-right: 5px;
}
} }
.tags-container { .tags-container {
display: flex; display: flex;
@@ -149,16 +176,12 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 30px; height: 30px;
color : white;
background-color : #555555;
border-top : 1px solid #666666;
border-bottom : 1px solid #666666;
span { span {
padding: 3px; padding: 3px;
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
color : #DFDFDF; color: #dfdfdf;
cursor: pointer; cursor: pointer;
border: 1px solid; border: 1px solid;
border-radius: 3px; border-radius: 3px;
@@ -175,30 +198,35 @@
} }
&.type { &.type {
background-color: #008000; background-color: #008000;
border-color : #00A000; border-color: #00a000;
&::before { content : '\f0ad'; } &::before {
content: '\f0ad';
}
} }
&.group { &.group {
background-color: #505050; background-color: #505050;
border-color: #000000; border-color: #000000;
&::before { content : '\f500'; } &::before {
content: '\f500';
}
} }
&.meta { &.meta {
background-color: #000080; background-color: #000080;
border-color : #0000A0; border-color: #0000a0;
&::before { content : '\f05a'; } &::before {
content: '\f05a';
}
} }
&.system { &.system {
background-color: #800000; background-color: #800000;
border-color : #A00000; border-color: #a00000;
&::before { content : '\f518'; } &::before {
content: '\f518';
}
} }
} }
} }
.layout-container { .layout-container {
position : sticky;
top : 0;
left : 0;
z-index: 1; z-index: 1;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@@ -206,16 +234,9 @@
column-gap: 15px; column-gap: 15px;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width : 100%;
height : 30px;
font-family : 'Open Sans', sans-serif;
color : white;
text-align: center; text-align: center;
background-color : #555555;
border-top : 1px solid #666666;
border-bottom : 1px solid #666666;
input[type="radio"] { input[type='radio'] {
display: none; display: none;
} }
@@ -228,3 +249,4 @@
} }
} }
} }
}