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

Arrange Topic before Region in server filters #272

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
80 changes: 40 additions & 40 deletions pages/servers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,45 +523,6 @@ const ServerFilters = ({
const intl = useIntl()
return (
<div className="mb-8">
<h3 className="h5 mb-4" id="category-group-label">
<FormattedMessage
id="server.filter_by.region"
defaultMessage="Region"
/>
</h3>

<p className="b3 mb-4 text-gray-2"><FormattedMessage id="server.filter_by.region.lead" defaultMessage="Where the provider is legally based." /></p>

<ul className="grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-1 md:gap-x-3 md:grid-cols-1 md:-ml-3 mb-8">
{regions?.map((item, i) => {
const isActive = filters.region === item.value

return (
<li key={i}>
<label
className={classnames(
"b2 flex cursor-pointer gap-1 rounded p-3 focus-visible-within:outline focus-visible-within:outline-2 focus-visible-within:outline-blurple-500",
isActive && "bg-nightshade-50 !font-extrabold"
)}
>
<input
className="sr-only"
type="checkbox"
name="filters-region"
onChange={() => {
setFilters({
...filters,
region: isActive ? "" : item.value,
})
}}
/>
{item.label}
</label>
</li>
)
})}
</ul>

<h3 className="h5 mb-4" id="category-group-label">
<FormattedMessage
id="server.filter_by.category"
Expand All @@ -571,7 +532,7 @@ const ServerFilters = ({

<p className="b3 mb-4 text-gray-2"><FormattedMessage id="server.filter_by.category.lead" defaultMessage="Some providers specialize in hosting accounts from specific communities." /></p>

<ul className="grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-1 md:gap-x-3 md:grid-cols-1 md:-ml-3">
<ul className="grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-1 md:gap-x-3 md:grid-cols-1 md:-ml-3 mb-8">
{!initialCategories
? new Array(11).fill(null).map((_, i) => (
<li className="h-8 p-3" key={i}>
Expand Down Expand Up @@ -614,6 +575,45 @@ const ServerFilters = ({
)
})}
</ul>

<h3 className="h5 mb-4" id="category-group-label">
<FormattedMessage
id="server.filter_by.region"
defaultMessage="Region"
/>
</h3>

<p className="b3 mb-4 text-gray-2"><FormattedMessage id="server.filter_by.region.lead" defaultMessage="Where the provider is legally based." /></p>

<ul className="grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-1 md:gap-x-3 md:grid-cols-1 md:-ml-3">
{regions?.map((item, i) => {
const isActive = filters.region === item.value

return (
<li key={i}>
<label
className={classnames(
"b2 flex cursor-pointer gap-1 rounded p-3 focus-visible-within:outline focus-visible-within:outline-2 focus-visible-within:outline-blurple-500",
isActive && "bg-nightshade-50 !font-extrabold"
)}
>
<input
className="sr-only"
type="checkbox"
name="filters-region"
onChange={() => {
setFilters({
...filters,
region: isActive ? "" : item.value,
})
}}
/>
{item.label}
</label>
</li>
)
})}
</ul>
</div>
)
}
Expand Down