mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
Reformat filters
This commit is contained in:
@@ -18,11 +18,9 @@ import {
|
|||||||
filteredTournamentsListAtom,
|
filteredTournamentsListAtom,
|
||||||
hoveredMapIdAtom,
|
hoveredMapIdAtom,
|
||||||
normsOnlyAtom,
|
normsOnlyAtom,
|
||||||
regionFilterAtom,
|
|
||||||
} from "@/atoms";
|
} from "@/atoms";
|
||||||
import { RegionSelect } from "@/components/RegionSelect";
|
import { RegionSelect } from "@/components/RegionSelect";
|
||||||
import SearchBar from "@/components/SearchBar";
|
import SearchBar from "@/components/SearchBar";
|
||||||
import { Select } from "@/components/form/Select";
|
|
||||||
import { useBreakpoint } from "@/hooks/tailwind";
|
import { useBreakpoint } from "@/hooks/tailwind";
|
||||||
import useDatePickerWidth from "@/hooks/useDatePickerWidth";
|
import useDatePickerWidth from "@/hooks/useDatePickerWidth";
|
||||||
import { DatePickerDirection } from "@/types";
|
import { DatePickerDirection } from "@/types";
|
||||||
@@ -80,14 +78,22 @@ const TournamentTable = () => {
|
|||||||
id="listing"
|
id="listing"
|
||||||
>
|
>
|
||||||
<div className="z-10 flex w-full flex-wrap items-center justify-start gap-3 p-3">
|
<div className="z-10 flex w-full flex-wrap items-center justify-start gap-3 p-3">
|
||||||
<SearchBar />
|
<div className="flex w-full flex-col gap-3 sm:flex-row">
|
||||||
|
<SearchBar className="w-full sm:w-auto" />
|
||||||
|
<RegionSelect
|
||||||
|
syncTitle={t("syncWithMapOption")}
|
||||||
|
classNameOverrides={{
|
||||||
|
container: () => "flex flex-1",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<BsCalendar2Date
|
<BsCalendar2Date
|
||||||
className={`cursor-pointer text-3xl ${datePickerColour}`}
|
className={`cursor-pointer text-3xl ${datePickerColour}`}
|
||||||
onClick={handleDatePickerClick}
|
onClick={handleDatePickerClick}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="flex flex-col gap-0 text-gray-900 dark:text-white">
|
<div className="flex text-gray-900 dark:text-white">
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -102,8 +108,6 @@ const TournamentTable = () => {
|
|||||||
<div className="hidden lg:block">
|
<div className="hidden lg:block">
|
||||||
<TimeControlFilters />
|
<TimeControlFilters />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<RegionSelect syncTitle={t("syncWithMapOption")} />
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center" ref={datePickerRef}>
|
<div className="flex justify-center" ref={datePickerRef}>
|
||||||
|
|||||||
@@ -3,10 +3,15 @@ import { useTransition } from "react";
|
|||||||
import { useAtom } from "jotai/index";
|
import { useAtom } from "jotai/index";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { IoCloseOutline } from "react-icons/io5";
|
import { IoCloseOutline } from "react-icons/io5";
|
||||||
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { searchStringAtom } from "@/atoms";
|
import { searchStringAtom } from "@/atoms";
|
||||||
|
|
||||||
const SearchBar = () => {
|
type SearchBarProps = {
|
||||||
|
className?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const SearchBar = ({ className }: SearchBarProps) => {
|
||||||
const t = useTranslations("Tournaments");
|
const t = useTranslations("Tournaments");
|
||||||
const [searchString, setSearchString] = useAtom(searchStringAtom);
|
const [searchString, setSearchString] = useAtom(searchStringAtom);
|
||||||
const [isPending, startTransition] = useTransition();
|
const [isPending, startTransition] = useTransition();
|
||||||
@@ -22,7 +27,7 @@ const SearchBar = () => {
|
|||||||
<label htmlFor="table-search" className="sr-only">
|
<label htmlFor="table-search" className="sr-only">
|
||||||
{t("searchLabel")}
|
{t("searchLabel")}
|
||||||
</label>
|
</label>
|
||||||
<div className="relative mt-1">
|
<div className="relative">
|
||||||
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
||||||
<svg
|
<svg
|
||||||
className="h-5 w-5 text-gray-500 dark:text-gray-400"
|
className="h-5 w-5 text-gray-500 dark:text-gray-400"
|
||||||
@@ -49,7 +54,10 @@ const SearchBar = () => {
|
|||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
id="table-search"
|
id="table-search"
|
||||||
className="block rounded-lg border border-gray-300 bg-gray-50 p-2.5 px-10 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
|
className={twMerge(
|
||||||
|
"block rounded-lg border border-gray-300 bg-gray-50 p-2.5 px-10 text-sm text-gray-900 focus:border-primary-500 focus:ring-primary-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-primary-500",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
placeholder={t("searchPlaceholder")}
|
placeholder={t("searchPlaceholder")}
|
||||||
value={searchString}
|
value={searchString}
|
||||||
onChange={(e) => updateSearchString(e.target.value)}
|
onChange={(e) => updateSearchString(e.target.value)}
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ export const classNames = <Option, IsMulti extends boolean = false>(
|
|||||||
indicatorSeparator: () => "w-px text-gray-900 dark:text-white",
|
indicatorSeparator: () => "w-px text-gray-900 dark:text-white",
|
||||||
control: (state) =>
|
control: (state) =>
|
||||||
twMerge(
|
twMerge(
|
||||||
"group flex w-full items-center justify-between rounded-lg border p-3 text-sm",
|
"group flex w-full items-center justify-between rounded-lg border p-2.5 text-sm",
|
||||||
"border-gray-300 bg-gray-50 text-gray-900 shadow-sm focus-within:border-primary-500 focus-within:ring-primary-500",
|
"border-gray-300 bg-gray-50 text-gray-900 focus-within:border-primary-500 focus-within:ring-primary-500",
|
||||||
"dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus-within:border-primary-500 dark:focus-within:ring-primary-500",
|
"dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus-within:border-primary-500 dark:focus-within:ring-primary-500",
|
||||||
|
|
||||||
hasError && "ring-1 ring-error",
|
hasError && "ring-1 ring-error",
|
||||||
state.isDisabled && "cursor-not-allowed",
|
state.isDisabled && "cursor-not-allowed",
|
||||||
state.isFocused && "border-primary ring ring-primary ring-opacity-50",
|
state.isFocused && "border-primary ring-1 ring-primary ring-opacity-50",
|
||||||
),
|
),
|
||||||
multiValue: () => "bg-fieldGray border rounded-lg flex space-x-1 pl-1 m-1",
|
multiValue: () => "bg-fieldGray border rounded-lg flex space-x-1 pl-1 m-1",
|
||||||
multiValueLabel: () => "",
|
multiValueLabel: () => "",
|
||||||
|
|||||||
Reference in New Issue
Block a user