@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.
@@ -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
- const NoResults = () => {
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
- const NoResultsTips = ({ filterTip, keywordTip }) => {
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
- const EmptyTitle = ({ primaryStart, primaryEnd, filter }) => {
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
- <Grid container {...rest}>
83
+ <StyledGrid container {...rest}>
85
84
  {blocklets.map((blocklet) => (
86
- <StyledGrid item lg={4} md={6} sm={6} xs={12} key={blocklet.did} data-blocklet-did={blocklet.did}>
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
- </StyledGrid>
87
+ </StyledGridItem>
89
88
  ))}
90
- </Grid>
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) {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
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
- const Search = ({ placeholder, ...rest }) => {
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
  };
@@ -1,4 +1,4 @@
1
- import React, { useContext, createContext, useMemo, useEffect } from 'react';
1
+ import { useContext, createContext, useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useRequest } from 'ahooks';
4
4
  import orderBy from 'lodash/orderBy';
package/src/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  import SelectBase from './base';
4
2
  import { FilterProvider } from './contexts/filter';
5
3
  import { propTypes, defaultProps } from './libs/prop-types';