mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 07:56:57 +00:00
Save layout
This commit is contained in:
parent
5b8c102ed4
commit
366ad21ed1
@ -6,6 +6,7 @@ import Sites from "@/components/cards/Sites";
|
||||
import axios from "axios";
|
||||
import { useEffect, useState, useCallback } from "react";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
interface SitesPageProps {
|
||||
username: string;
|
||||
@ -40,6 +41,13 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
||||
loadSites();
|
||||
}, [loadSites]);
|
||||
|
||||
useEffect(() => {
|
||||
const itemPerPage = Cookies.get('sites-itemPerPage');
|
||||
if (itemPerPage) {
|
||||
setItemPerPage(Number(itemPerPage));
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Sidebar
|
||||
username={username}
|
||||
@ -61,7 +69,10 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
||||
|
||||
<div className="flex gap-2 items-center pt-4">
|
||||
<input type="text" placeholder="Search..." className="input input-bordered w-full" onChange={(e) => setSearch(e.target.value)} />
|
||||
<select defaultValue="Pick a font" className="select w-24" onChange={(e) => setItemPerPage(Number(e.target.value))}>
|
||||
<select defaultValue="Pick a font" className="select w-24" value={itemPerPage} onChange={(e) => {
|
||||
setItemPerPage(Number(e.target.value));
|
||||
Cookies.set('sites-itemPerPage', e.target.value);
|
||||
}}>
|
||||
<option disabled={true}>Layout</option>
|
||||
<option value={5}>List</option>
|
||||
<option value={10}>Grid</option>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user