|
1 | | -import { CircularProgress, Button, Grid } from "@mui/material"; |
2 | | -import { List } from "antd"; |
| 1 | +import { CircularProgress, Button, Grid, List, ListItem } from "@mui/material"; |
3 | 2 | import { useTranslation } from "next-i18next"; |
4 | 3 | import React, { useEffect, useState } from "react"; |
5 | 4 | import colors from "../../styles/colors"; |
@@ -103,62 +102,86 @@ const BaseList = ({ |
103 | 102 |
|
104 | 103 | const loadMoreButton = |
105 | 104 | totalPages > query.page ? ( |
106 | | - <div |
| 105 | + <Button |
| 106 | + variant="outlined" |
| 107 | + onClick={loadMoreData} |
107 | 108 | style={{ |
108 | | - textAlign: "center", |
109 | | - marginTop: 12, |
110 | | - height: 32, |
111 | | - lineHeight: "32px", |
| 109 | + color: colors.primary, |
| 110 | + fontSize: 14 |
112 | 111 | }} |
113 | 112 | > |
114 | | - <Button onClick={loadMoreData}> |
115 | | - {t("list:loadMoreButton")} |
116 | | - </Button> |
117 | | - </div> |
| 113 | + {t("list:loadMoreButton")} |
| 114 | + </Button> |
118 | 115 | ) : null; |
119 | 116 |
|
120 | 117 | if (items && Array.isArray(items) && (items.length > 0 || !emptyFallback)) { |
121 | 118 | return ( |
122 | 119 | <> |
| 120 | + <Grid container |
| 121 | + style={{ |
| 122 | + alignContent: "middle", |
| 123 | + justifyContent: "space-between", |
| 124 | + padding: "12px 0", |
| 125 | + borderBottom: "1px solid #eee" |
| 126 | + }} |
| 127 | + > |
| 128 | + <Grid item> |
| 129 | + <h2 |
| 130 | + style={{ |
| 131 | + fontSize: "24px", |
| 132 | + lineHeight: "32px", |
| 133 | + color: bluePrimary |
| 134 | + ? colors.primary |
| 135 | + : colors.black, |
| 136 | + marginBottom: 0, |
| 137 | + }} |
| 138 | + > |
| 139 | + {title} |
| 140 | + </h2> |
| 141 | + <p |
| 142 | + style={{ |
| 143 | + fontSize: "14px", |
| 144 | + marginBottom: 0, |
| 145 | + }} |
| 146 | + > |
| 147 | + {t("list:totalItems", { |
| 148 | + total: totalItems, |
| 149 | + })} |
| 150 | + </p> |
| 151 | + </Grid> |
| 152 | + <Grid item> |
| 153 | + <SortByButton |
| 154 | + refreshListItems={refreshListItems} |
| 155 | + /> |
| 156 | + </Grid> |
| 157 | + </Grid> |
123 | 158 | <List |
124 | | - itemLayout="horizontal" |
125 | | - grid={grid} |
126 | | - split={showDividers} |
127 | | - header={ |
128 | | - <Grid container style={{alignContent:"middle", justifyContent:"space-between"}}> |
129 | | - <Grid item> |
130 | | - <h2 |
131 | | - style={{ |
132 | | - fontSize: "24px", |
133 | | - lineHeight: "32px", |
134 | | - color: bluePrimary |
135 | | - ? colors.primary |
136 | | - : colors.black, |
137 | | - marginBottom: 0, |
138 | | - }} |
139 | | - > |
140 | | - {title} |
141 | | - </h2> |
142 | | - |
143 | | - {t("list:totalItems", { |
144 | | - total: totalItems, |
145 | | - })} |
146 | | - </Grid> |
147 | | - <Grid item> |
148 | | - <SortByButton |
149 | | - refreshListItems={refreshListItems} |
150 | | - /> |
| 159 | + style={{ |
| 160 | + display: "flex", |
| 161 | + flexDirection: "row", |
| 162 | + flexWrap: "wrap", |
| 163 | + padding: 0, |
| 164 | + }} |
| 165 | + > |
| 166 | + {loading && loadingProps ? ( |
| 167 | + <Grid container style={{ display: "flex", justifyContent: "center", padding: 2 }}> |
| 168 | + {loadingIcon} |
| 169 | + </Grid> |
| 170 | + ) : ( |
| 171 | + items.map((item) => ( |
| 172 | + <Grid container item {...grid}> |
| 173 | + <ListItem key={item} style={{ borderBottom: showDividers ? "1px solid #eee" : "none", padding: "0 10px", ...style }}> |
| 174 | + {renderItem(item)} |
| 175 | + </ListItem> |
151 | 176 | </Grid> |
| 177 | + )) |
| 178 | + )} |
| 179 | + {loadMoreButton && ( |
| 180 | + <Grid item style={{ width: "100%", display: "flex", justifyContent: "center" }}> |
| 181 | + {loadMoreButton} |
152 | 182 | </Grid> |
153 | | - } |
154 | | - style={style || {}} |
155 | | - loadMore={loadMoreButton} |
156 | | - loading={loading && loadingProps} |
157 | | - dataSource={items} |
158 | | - renderItem={(item) => { |
159 | | - return <List.Item>{renderItem(item)}</List.Item>; |
160 | | - }} |
161 | | - /> |
| 183 | + )} |
| 184 | + </List > |
162 | 185 | <Grid container |
163 | 186 | style={{ |
164 | 187 | textAlign: "center", |
|
0 commit comments