@blocklet/list 0.8.25 → 0.8.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base.js +61 -53
- package/lib/components/aside.js +24 -19
- package/lib/components/custom-select/button.js +13 -8
- package/lib/components/custom-select/custom-select.js +70 -54
- package/lib/components/filter/custom-chip.js +16 -8
- package/lib/components/filter/group.js +19 -15
- package/lib/components/filter/icon.js +39 -36
- package/lib/components/list/empty.js +39 -28
- package/lib/components/list/list.js +70 -46
- package/lib/components/search.js +21 -15
- package/lib/contexts/filter.js +7 -8
- package/lib/index.js +11 -3
- package/package.json +9 -5
- package/src/base.js +2 -3
- package/src/components/aside.js +2 -3
- package/src/components/custom-select/button.js +1 -1
- package/src/components/custom-select/custom-select.js +6 -5
- package/src/components/filter/custom-chip.js +2 -3
- package/src/components/filter/group.js +0 -1
- package/src/components/filter/icon.js +1 -1
- package/src/components/list/empty.js +6 -7
- package/src/components/list/list.js +11 -7
- package/src/components/search.js +3 -3
- package/src/contexts/filter.js +1 -1
- package/src/index.js +0 -2
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import Box from '@mui/material/Box';
|
|
4
3
|
import Typography from '@mui/material/Typography';
|
|
5
4
|
|
|
6
5
|
import { useFilterContext } from '../../contexts/filter';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
function NoResults() {
|
|
9
8
|
const { t } = useFilterContext();
|
|
10
9
|
return (
|
|
11
10
|
<Typography style={{ textAlign: 'center' }} variant="subtitle2">
|
|
12
11
|
{t('blocklet.noResults')}
|
|
13
12
|
</Typography>
|
|
14
13
|
);
|
|
15
|
-
}
|
|
16
|
-
|
|
14
|
+
}
|
|
15
|
+
function NoResultsTips({ filterTip, keywordTip }) {
|
|
17
16
|
const { t, locale } = useFilterContext();
|
|
18
17
|
|
|
19
18
|
const getSplit = () => {
|
|
@@ -28,7 +27,7 @@ const NoResultsTips = ({ filterTip, keywordTip }) => {
|
|
|
28
27
|
{keywordTip && <span>{t('blocklet.keywordTip')}</span>}
|
|
29
28
|
</Box>
|
|
30
29
|
);
|
|
31
|
-
}
|
|
30
|
+
}
|
|
32
31
|
NoResultsTips.propTypes = {
|
|
33
32
|
filterTip: PropTypes.bool,
|
|
34
33
|
keywordTip: PropTypes.bool,
|
|
@@ -38,7 +37,7 @@ NoResultsTips.defaultProps = {
|
|
|
38
37
|
filterTip: false,
|
|
39
38
|
keywordTip: false,
|
|
40
39
|
};
|
|
41
|
-
|
|
40
|
+
function EmptyTitle({ primaryStart, primaryEnd, filter }) {
|
|
42
41
|
return (
|
|
43
42
|
<Typography variant="subtitle2">
|
|
44
43
|
<span>{primaryStart}</span>
|
|
@@ -46,7 +45,7 @@ const EmptyTitle = ({ primaryStart, primaryEnd, filter }) => {
|
|
|
46
45
|
<span>{primaryEnd} </span>
|
|
47
46
|
</Typography>
|
|
48
47
|
);
|
|
49
|
-
}
|
|
48
|
+
}
|
|
50
49
|
EmptyTitle.propTypes = {
|
|
51
50
|
primaryStart: PropTypes.string.isRequired,
|
|
52
51
|
primaryEnd: PropTypes.string.isRequired,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
2
|
import styled from 'styled-components';
|
|
4
3
|
import Empty from '@arcblock/ux/lib/Empty';
|
|
@@ -81,13 +80,13 @@ export default function BlockletList({ blocklets, ...rest }) {
|
|
|
81
80
|
}
|
|
82
81
|
|
|
83
82
|
return (
|
|
84
|
-
<
|
|
83
|
+
<StyledGrid container {...rest}>
|
|
85
84
|
{blocklets.map((blocklet) => (
|
|
86
|
-
<
|
|
85
|
+
<StyledGridItem item lg={4} md={6} sm={6} xs={12} key={blocklet.did} data-blocklet-did={blocklet.did}>
|
|
87
86
|
{blockletRender({ blocklet, blocklets: blockletList })}
|
|
88
|
-
</
|
|
87
|
+
</StyledGridItem>
|
|
89
88
|
))}
|
|
90
|
-
</
|
|
89
|
+
</StyledGrid>
|
|
91
90
|
);
|
|
92
91
|
}
|
|
93
92
|
|
|
@@ -98,11 +97,16 @@ BlockletList.propTypes = {
|
|
|
98
97
|
BlockletList.defaultProps = {};
|
|
99
98
|
|
|
100
99
|
const StyledGrid = styled(Grid)`
|
|
100
|
+
&.MuiGrid-root {
|
|
101
|
+
width: auto;
|
|
102
|
+
margin: 0 -16px;
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
const StyledGridItem = styled(Grid)`
|
|
101
107
|
@media (max-width: ${(props) => props.theme.breakpoints.values.sm}px) {
|
|
102
108
|
&.MuiGrid-item {
|
|
103
109
|
padding-bottom: 0px;
|
|
104
|
-
margin-left: ${(props) => props.theme.spacing(-2)};
|
|
105
|
-
padding-right: ${(props) => props.theme.spacing(0.5)};
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
@media (min-width: ${(props) => props.theme.breakpoints.values.sm}px) {
|
package/src/components/search.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import SearchIcon from '@mui/icons-material/Search';
|
|
4
4
|
import CloseIcon from '@mui/icons-material/Close';
|
|
@@ -8,7 +8,7 @@ import styled from 'styled-components';
|
|
|
8
8
|
|
|
9
9
|
import { useFilterContext } from '../contexts/filter';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function Search({ placeholder, ...rest }) {
|
|
12
12
|
const { filters, handleKeyword } = useFilterContext();
|
|
13
13
|
const [searchStr, setSearchStr] = useState(filters.keyword || '');
|
|
14
14
|
|
|
@@ -51,7 +51,7 @@ const Search = ({ placeholder, ...rest }) => {
|
|
|
51
51
|
{...rest}
|
|
52
52
|
/>
|
|
53
53
|
);
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
Search.propTypes = {
|
|
56
56
|
placeholder: PropTypes.string,
|
|
57
57
|
};
|
package/src/contexts/filter.js
CHANGED