mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
update ui components for mobile (#1495)
* fix mobile layout for filter buttons * fix tabs component mobile view * fix zoom in on input focus on mobile devices * reduce searchbar font-size
This commit is contained in:
parent
8396b705d3
commit
8249ff1397
@ -1,14 +1,20 @@
|
|||||||
|
.tabListContainer {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.tabList {
|
.tabList {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-bottom: 1px solid var(--border-color);
|
|
||||||
padding: calc(var(--spacer) / 2);
|
padding: calc(var(--spacer) / 2);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: calc(var(--spacer) / 8) var(--spacer);
|
padding: calc(var(--spacer) / 8) calc(var(--spacer) / 2);
|
||||||
font-weight: var(--font-weight-bold);
|
font-weight: var(--font-weight-bold);
|
||||||
font-size: var(--font-size-small);
|
font-size: var(--font-size-small);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@ -16,7 +22,6 @@
|
|||||||
background-color: var(--background-body);
|
background-color: var(--background-body);
|
||||||
border: 1px solid var(--border-color);
|
border: 1px solid var(--border-color);
|
||||||
margin-right: -1px;
|
margin-right: -1px;
|
||||||
min-width: 90px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab,
|
.tab,
|
||||||
@ -27,11 +32,13 @@
|
|||||||
.tab:first-child {
|
.tab:first-child {
|
||||||
border-top-left-radius: var(--border-radius);
|
border-top-left-radius: var(--border-radius);
|
||||||
border-bottom-left-radius: var(--border-radius);
|
border-bottom-left-radius: var(--border-radius);
|
||||||
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab:last-child {
|
.tab:last-child {
|
||||||
border-top-right-radius: var(--border-radius);
|
border-top-right-radius: var(--border-radius);
|
||||||
border-bottom-right-radius: var(--border-radius);
|
border-bottom-right-radius: var(--border-radius);
|
||||||
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab[aria-selected='true'] {
|
.tab[aria-selected='true'] {
|
||||||
@ -58,6 +65,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 60rem) {
|
||||||
|
.tab {
|
||||||
|
padding: calc(var(--spacer) / 8) var(--spacer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.radio {
|
.radio {
|
||||||
composes: radio from '../../FormInput/InputRadio.module.css';
|
composes: radio from '../../FormInput/InputRadio.module.css';
|
||||||
}
|
}
|
||||||
|
@ -26,28 +26,32 @@ export default function Tabs({
|
|||||||
}: TabsProps): ReactElement {
|
}: TabsProps): ReactElement {
|
||||||
return (
|
return (
|
||||||
<ReactTabs className={`${className || ''}`} defaultIndex={defaultIndex}>
|
<ReactTabs className={`${className || ''}`} defaultIndex={defaultIndex}>
|
||||||
<TabList className={styles.tabList}>
|
<div className={styles.tabListContainer}>
|
||||||
{items.map((item, index) => (
|
<TabList className={styles.tabList}>
|
||||||
<Tab
|
{items.map((item, index) => (
|
||||||
className={styles.tab}
|
<Tab
|
||||||
key={index}
|
className={styles.tab}
|
||||||
onClick={handleTabChange ? () => handleTabChange(item.title) : null}
|
key={index}
|
||||||
disabled={item.disabled}
|
onClick={
|
||||||
>
|
handleTabChange ? () => handleTabChange(item.title) : null
|
||||||
{showRadio ? (
|
}
|
||||||
<InputRadio
|
disabled={item.disabled}
|
||||||
name={item.title}
|
>
|
||||||
type="radio"
|
{showRadio ? (
|
||||||
checked={index === defaultIndex}
|
<InputRadio
|
||||||
options={[item.title]}
|
name={item.title}
|
||||||
readOnly
|
type="radio"
|
||||||
/>
|
checked={index === defaultIndex}
|
||||||
) : (
|
options={[item.title]}
|
||||||
item.title
|
readOnly
|
||||||
)}
|
/>
|
||||||
</Tab>
|
) : (
|
||||||
))}
|
item.title
|
||||||
</TabList>
|
)}
|
||||||
|
</Tab>
|
||||||
|
))}
|
||||||
|
</TabList>
|
||||||
|
</div>
|
||||||
<div className={styles.tabContent}>
|
<div className={styles.tabContent}>
|
||||||
{items.map((item, index) => (
|
{items.map((item, index) => (
|
||||||
<TabPanel key={index}>{item.content}</TabPanel>
|
<TabPanel key={index}>{item.content}</TabPanel>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
|
font-size: 16px; /* prevent zoom in on input focus on mobile devices */
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
.filterList,
|
.filterList,
|
||||||
div.filterList {
|
div.filterList {
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
|
margin-top: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
gap: calc(var(--spacer) / 4) calc(var(--spacer) / 2);
|
||||||
|
flex-direction: column;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.separator {
|
|
||||||
width: calc(var(--spacer) / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter {
|
.filter {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
@ -65,3 +63,10 @@ button.filter,
|
|||||||
.hideClear {
|
.hideClear {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 35rem) {
|
||||||
|
.filterList,
|
||||||
|
div.filterList {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -137,66 +137,69 @@ export default function FilterPrice({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styleClasses}>
|
<div className={styleClasses}>
|
||||||
{serviceFilterItems.map((e, index) => {
|
<div>
|
||||||
const isServiceSelected =
|
{serviceFilterItems.map((e, index) => {
|
||||||
e.value === serviceType || serviceSelections.includes(e.value)
|
const isServiceSelected =
|
||||||
const selectFilter = cx({
|
e.value === serviceType || serviceSelections.includes(e.value)
|
||||||
[styles.selected]: isServiceSelected,
|
const selectFilter = cx({
|
||||||
[styles.filter]: true
|
[styles.selected]: isServiceSelected,
|
||||||
})
|
[styles.filter]: true
|
||||||
return (
|
})
|
||||||
<Button
|
return (
|
||||||
size="small"
|
<Button
|
||||||
style="text"
|
size="small"
|
||||||
key={index}
|
style="text"
|
||||||
className={selectFilter}
|
key={index}
|
||||||
onClick={async () => {
|
className={selectFilter}
|
||||||
handleSelectedFilter(isServiceSelected, e.value)
|
onClick={async () => {
|
||||||
}}
|
handleSelectedFilter(isServiceSelected, e.value)
|
||||||
>
|
}}
|
||||||
{e.display}
|
>
|
||||||
</Button>
|
{e.display}
|
||||||
)
|
</Button>
|
||||||
})}
|
)
|
||||||
<div className={styles.separator} />
|
})}
|
||||||
{accessFilterItems.map((e, index) => {
|
</div>
|
||||||
const isAccessSelected =
|
<div>
|
||||||
e.value === accessType || accessSelections.includes(e.value)
|
{accessFilterItems.map((e, index) => {
|
||||||
const selectFilter = cx({
|
const isAccessSelected =
|
||||||
[styles.selected]: isAccessSelected,
|
e.value === accessType || accessSelections.includes(e.value)
|
||||||
[styles.filter]: true
|
const selectFilter = cx({
|
||||||
})
|
[styles.selected]: isAccessSelected,
|
||||||
return (
|
[styles.filter]: true
|
||||||
<Button
|
})
|
||||||
size="small"
|
return (
|
||||||
style="text"
|
<Button
|
||||||
key={index}
|
size="small"
|
||||||
className={selectFilter}
|
style="text"
|
||||||
onClick={async () => {
|
key={index}
|
||||||
handleSelectedFilter(isAccessSelected, e.value)
|
className={selectFilter}
|
||||||
}}
|
onClick={async () => {
|
||||||
>
|
handleSelectedFilter(isAccessSelected, e.value)
|
||||||
{e.display}
|
}}
|
||||||
</Button>
|
>
|
||||||
)
|
{e.display}
|
||||||
})}
|
</Button>
|
||||||
{clearFilters.map((e, index) => {
|
)
|
||||||
const showClear =
|
})}
|
||||||
accessSelections.length > 0 || serviceSelections.length > 0
|
{clearFilters.map((e, index) => {
|
||||||
return (
|
const showClear =
|
||||||
<Button
|
accessSelections.length > 0 || serviceSelections.length > 0
|
||||||
size="small"
|
return (
|
||||||
style="text"
|
<Button
|
||||||
key={index}
|
size="small"
|
||||||
className={showClear ? styles.showClear : styles.hideClear}
|
style="text"
|
||||||
onClick={async () => {
|
key={index}
|
||||||
applyClearFilter(addFiltersToUrl)
|
className={showClear ? styles.showClear : styles.hideClear}
|
||||||
}}
|
onClick={async () => {
|
||||||
>
|
applyClearFilter(addFiltersToUrl)
|
||||||
{e.display}
|
}}
|
||||||
</Button>
|
>
|
||||||
)
|
{e.display}
|
||||||
})}
|
</Button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
margin-bottom: calc(var(--spacer) / 2);
|
margin-bottom: calc(var(--spacer) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 40rem) {
|
@media (min-width: 55rem) {
|
||||||
.row {
|
.row {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 40rem) {
|
@media (min-width: 55rem) {
|
||||||
.sortList {
|
.sortList {
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
overflow-y: unset;
|
overflow-y: unset;
|
||||||
|
Loading…
Reference in New Issue
Block a user