Profile page improvements.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Table, Button, Typography } from "antd";
|
||||
import { Table, Button, Typography, Space, Input, Card, Col } from "antd";
|
||||
export default function ProfileShopsComponent({
|
||||
loading,
|
||||
data,
|
||||
updateActiveShop,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [search, setSearch] = useState("");
|
||||
const columns = [
|
||||
{
|
||||
title: t("associations.fields.shopname"),
|
||||
@@ -39,18 +39,39 @@ export default function ProfileShopsComponent({
|
||||
),
|
||||
},
|
||||
];
|
||||
console.log("🚀 ~ file: profile-shops.component.jsx:45 ~ data", data);
|
||||
const filteredData =
|
||||
search === ""
|
||||
? data
|
||||
: data.filter((d) =>
|
||||
d.bodyshop.shopname.toLowerCase().includes(search.toLowerCase())
|
||||
);
|
||||
|
||||
return (
|
||||
<Table
|
||||
title={() => (
|
||||
<Typography.Title level={4}>
|
||||
{t("profile.labels.activeshop")}
|
||||
</Typography.Title>
|
||||
)}
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={data}
|
||||
/>
|
||||
<Col span={24}>
|
||||
<Card
|
||||
title={
|
||||
<Typography.Title level={4}>
|
||||
{t("profile.labels.activeshop")}
|
||||
</Typography.Title>
|
||||
}
|
||||
extra={
|
||||
<Input.Search
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
allowClear
|
||||
placeholder={t("general.labels.search")}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Table
|
||||
pagination={false}
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
rowKey="id"
|
||||
dataSource={filteredData}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user