@riosst100/pwa-marketplace 1.2.6 → 1.2.8

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,13 +1,21 @@
1
1
  import React from 'react';
2
- import { ArrowDown2 } from 'iconsax-react';
2
+ import { ArrowDown2, Filter } from 'iconsax-react';
3
3
 
4
4
  const Sort = () => {
5
5
  return (
6
6
  <>
7
- <div class="inline-flex flex-col items-start gap-[10px] px-[15px] py-[10px] relative flex-[0_0_auto] bg-white rounded-[30px] border border-solid border-[#e6e9ea]">
8
- <div class="inline-flex items-center gap-[20px] relative flex-[0_0_auto]">
9
- <div class="relative w-fit [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal] whitespace-nowrap">Most relevant</div>
10
- <ArrowDown2 color="#292D32" size={14} variant="Outline" className='stroke-[#292D32]' />
7
+ <div className='x-container xs_flex xs_justify-between xs_w-full xl_w-fit'>
8
+ <div class="xs_flex xl_hidden flex-col items-start gap-[10px] px-[15px] py-[10px] relative flex-[0_0_auto] bg-white rounded-[30px] border border-solid border-gray-100">
9
+ <div class="inline-flex items-center gap-[20px] relative flex-[0_0_auto]">
10
+ <Filter color="#292D32" size={14} variant="Outline" className='stroke-[#292D32]' />
11
+ <div class="relative w-fit text-[14px] tracking-[0] leading-[normal] whitespace-nowrap">Filter</div>
12
+ </div>
13
+ </div>
14
+ <div class="inline-flex flex-col items-start gap-[10px] px-[15px] py-[10px] relative flex-[0_0_auto] bg-white rounded-[30px] border border-solid border-gray-100">
15
+ <div class="inline-flex items-center gap-[20px] relative flex-[0_0_auto]">
16
+ <div class="relative w-fit text-[14px] tracking-[0] leading-[normal] whitespace-nowrap">Most relevant</div>
17
+ <ArrowDown2 color="#292D32" size={14} variant="Outline" className='stroke-[#292D32]' />
18
+ </div>
11
19
  </div>
12
20
  </div>
13
21
  </>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import cx from 'classnames';
2
+ import cn from 'classnames';
3
3
 
4
4
  const Tabs = (props) => {
5
5
  const {
@@ -11,14 +11,16 @@ const Tabs = (props) => {
11
11
  tabContentContainerClassName = '',
12
12
  tabContentWrapperClassName = '',
13
13
  tabActiveClassName = '',
14
+ tabWrapperClassName = '',
14
15
  } = props
15
16
 
16
17
  const [activeTabs, setActiveTabs] = React.useState(0);
17
- const rootClass = cx('mb-4 border-b border-gray-200 dark:border-gray-700', rootClassName);
18
- const tabTitleClass = cx('inline-block p-4 rounded-t-lg', tabTitleClassName);
19
- const tabContainerClass = cx('tab-content-container', tabContentContainerClassName);
20
- const tabContentWrapperClass = cx('tab-content-wrapper', tabContentWrapperClassName);
21
- const tabActiveClass = cx('border-solid border-b-2', tabActiveClassName)
18
+ const rootClass = cn('mb-4 border-b border-gray-100', rootClassName);
19
+ const tabTitleClass = cn('inline-block p-[10px] rounded-t-lg text-[16px] font-semibold', tabTitleClassName);
20
+ const tabContainerClass = cn('tab-content-container', tabContentContainerClassName);
21
+ const tabContentWrapperClass = cn('tab-content-wrapper', tabContentWrapperClassName);
22
+ const tabActiveClass = cn('border-solid border-b-2', tabActiveClassName);
23
+ const tabWrapperClass = cn('flex flex-wrap -mb-px text-sm font-medium text-center gap-4', tabWrapperClassName);
22
24
 
23
25
  const handleSwicthTab = (index) => {
24
26
  setActiveTabs(index);
@@ -27,11 +29,11 @@ const Tabs = (props) => {
27
29
  return (
28
30
  <>
29
31
  <div className={rootClass}>
30
- <ul className='flex flex-wrap -mb-px text-sm font-medium text-center' role='tablist'>
32
+ <ul className={tabWrapperClass} role='tablist'>
31
33
  {data.map((item, index) => (
32
34
  <li className='me-2' role='presentation'>
33
35
  <button
34
- className={cx(tabTitleClass, index === activeTabs ? tabActiveClass : '')}
36
+ className={cn(tabTitleClass, index === activeTabs ? tabActiveClass : '')}
35
37
  id={item.id}
36
38
  role='tab'
37
39
  aria-controls={`${item.id}-tab`}
@@ -50,7 +52,7 @@ const Tabs = (props) => {
50
52
  {hasContent ? (
51
53
  <div className={tabContainerClass}>
52
54
  {data.map((item, index) => (
53
- <div className={cx(index !== activeTabs ? 'hidden' : '', tabContentWrapperClass)} role='tabpanel' aria-labelledby={`${item.id}-tab`}>
55
+ <div className={cn(index !== activeTabs ? 'hidden' : '', tabContentWrapperClass)} role='tabpanel' aria-labelledby={`${item.id}-tab`}>
54
56
  {item.content}
55
57
  </div>
56
58
  ))}
@@ -19,8 +19,9 @@ import BecomeSellerLink from '@riosst100/pwa-marketplace/src/components/BecomeSe
19
19
  import MegaMenu from '@magento/venia-ui/lib/components/MegaMenu';
20
20
  import PageLoadingIndicator from '@magento/venia-ui/lib/components/PageLoadingIndicator';
21
21
  import { useIntl } from 'react-intl';
22
-
23
- const SearchBar = React.lazy(() => import('@magento/venia-ui/lib/components/SearchBar'));
22
+ import cn from 'classnames';
23
+ // const SearchBar = React.lazy(() => import('@magento/venia-ui/lib/components/SearchBar'));
24
+ const SearchBar = React.lazy(() => import('@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/SearchBar'));
24
25
 
25
26
  const Header = props => {
26
27
  const {
@@ -45,19 +46,20 @@ const Header = props => {
45
46
  </div>
46
47
  </div>
47
48
  );
48
- const searchBar = isSearchOpen ? (
49
- <Suspense fallback={searchBarFallback}>
50
- <Route>
51
- <SearchBar isOpen={isSearchOpen} ref={searchRef} />
52
- </Route>
53
- </Suspense>
54
- ) : null;
49
+ // const searchBar = isSearchOpen ? (
50
+ // <Suspense fallback={searchBarFallback}>
51
+ // <Route>
52
+ // <SearchBar isOpen={true} ref={searchRef} />
53
+ // </Route>
54
+ // </Suspense>
55
+ // ) : null;
55
56
 
56
57
  const { formatMessage } = useIntl();
57
58
  const title = formatMessage({ id: 'logo.title', defaultMessage: 'Venia' });
58
59
 
59
60
  return (
60
61
  <Fragment>
62
+ <PageLoadingIndicator absolute />
61
63
  <div className={classes.switchersContainer}>
62
64
  <div className={classes.switchers} data-cy="Header-switchers">
63
65
  <BecomeSellerLink />
@@ -66,33 +68,43 @@ const Header = props => {
66
68
  <CurrencySwitcher />
67
69
  </div>
68
70
  </div>
69
- <header className={rootClass} data-cy="Header-root">
70
- <div className={classes.toolbar}>
71
- <div className={classes.primaryActions}>
72
- <NavTrigger />
73
- </div>
74
-
75
- <Link
76
- aria-label={title}
77
- to={resourceUrl('/')}
78
- className={classes.logoContainer}
79
- data-cy="Header-logoContainer"
80
- >
81
- <div><b>TCG Collective</b></div>
82
- <small>Toys | Card | Games</small>
83
- </Link>
84
- <MegaMenu />
85
- <div className={classes.secondaryActions}>
86
- <SearchTrigger
87
- onClick={handleSearchTriggerClick}
88
- ref={searchTriggerRef}
89
- />
90
- <AccountTrigger />
91
- <CartTrigger />
71
+ <header className={cn(rootClass, '!flex flex-col !px-0 border-gray-100 ')} data-cy="Header-root">
72
+ <div className={cn('middle-header border-b border-gray-100')}>
73
+ <div className={cn('w-full max-w-[1210px] px-[15px] py-[20px] mx-[auto] flex justify-between items-center')}>
74
+ <div className='flex'>
75
+ <NavTrigger />
76
+ <Link
77
+ aria-label={title}
78
+ to={resourceUrl('/')}
79
+ className={''}
80
+ data-cy="Header-logoContainer"
81
+ >
82
+ <div><b>TCG Collective</b></div>
83
+ <small>Toys | Card | Games</small>
84
+ </Link>
85
+ </div>
86
+ <div className='flex'>
87
+ <Suspense fallback={searchBarFallback}>
88
+ <Route>
89
+ <SearchBar isOpen={true} ref={searchRef} />
90
+ </Route>
91
+ </Suspense>
92
+ </div>
93
+ <div className={classes.secondaryActions}>
94
+ {/* <SearchTrigger
95
+ onClick={handleSearchTriggerClick}
96
+ ref={searchTriggerRef}
97
+ /> */}
98
+ <AccountTrigger />
99
+ <CartTrigger />
100
+ </div>
92
101
  </div>
93
102
  </div>
94
- {searchBar}
95
- <PageLoadingIndicator absolute />
103
+ <MegaMenu
104
+ rootClassName={cn('nav-menu w-full max-w-[1210px] px-[15px] mx-[auto] flex-row gap-x-[40px]')}
105
+ megaMenuItemClassname={cn('px-0 py-[15px] leading-[20px]')}
106
+ titleClassName={cn('font-medium leading-[20px]')}
107
+ />
96
108
  </header>
97
109
  <OnlineIndicator
98
110
  hasBeenOffline={hasBeenOffline}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import Content from './sellerPage';
3
-
4
- const core = () => {
5
- return (
6
- <Content />
7
- )
8
- }
9
-
10
- export default core;
@@ -1,129 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { useLazyQuery, useQuery } from '@apollo/client';
3
-
4
- import mergeOperations from '../../../util/shallowMerge';
5
- import { useEventingContext } from '../../../context/eventing';
6
-
7
- import DEFAULT_OPERATIONS from './categoryContent.gql';
8
-
9
- /**
10
- * Returns props necessary to render the categoryContent component.
11
- *
12
- * @param {object} props.data - The results of a getCategory GraphQL query.
13
- *
14
- * @returns {object} result
15
- * @returns {string} result.categoryDescription - This category's description.
16
- * @returns {string} result.categoryName - This category's name.
17
- * @returns {object} result.filters - The filters object.
18
- * @returns {object} result.items - The items in this category.
19
- * @returns {number} result.totalPagesFromData - The total amount of pages for the query.
20
- */
21
- export const useSellerProducts = props => {
22
- const { categoryId, data, pageSize = 6 } = props;
23
-
24
- const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
25
-
26
- const {
27
- getSellerProductsQuery,
28
- getProductFiltersByCategoryQuery,
29
- getCategoryAvailableSortMethodsQuery
30
- } = operations;
31
-
32
- const placeholderItems = Array.from({ length: pageSize }).fill(null);
33
-
34
- const [getFilters, { data: filterData }] = useLazyQuery(
35
- getProductFiltersByCategoryQuery,
36
- {
37
- fetchPolicy: 'cache-and-network',
38
- nextFetchPolicy: 'cache-first'
39
- }
40
- );
41
-
42
- const [getSortMethods, { data: sortData }] = useLazyQuery(
43
- getCategoryAvailableSortMethodsQuery,
44
- {
45
- fetchPolicy: 'cache-and-network',
46
- nextFetchPolicy: 'cache-first'
47
- }
48
- );
49
-
50
- const { data: categoryData, loading: categoryLoading } = useQuery(
51
- getSellerProductsQuery,
52
- {
53
- fetchPolicy: 'cache-and-network',
54
- nextFetchPolicy: 'cache-first',
55
- skip: !categoryId,
56
- variables: {
57
- id: categoryId
58
- }
59
- }
60
- );
61
-
62
- const [, { dispatch }] = useEventingContext();
63
-
64
- useEffect(() => {
65
- if (categoryId) {
66
- getFilters({
67
- variables: {
68
- categoryIdFilter: {
69
- eq: categoryId
70
- }
71
- }
72
- });
73
- }
74
- }, [categoryId, getFilters]);
75
-
76
- useEffect(() => {
77
- if (categoryId) {
78
- getSortMethods({
79
- variables: {
80
- categoryIdFilter: {
81
- in: categoryId
82
- }
83
- }
84
- });
85
- }
86
- }, [categoryId, getSortMethods]);
87
-
88
- const filters = filterData ? filterData.products.aggregations : null;
89
- const items = data ? data.products.items : placeholderItems;
90
- const totalPagesFromData = data
91
- ? data.products.page_info.total_pages
92
- : null;
93
- const totalCount = data ? data.products.total_count : null;
94
- const categoryName =
95
- categoryData && categoryData.categories.items.length
96
- ? categoryData.categories.items[0].name
97
- : null;
98
- const categoryDescription =
99
- categoryData && categoryData.categories.items.length
100
- ? categoryData.categories.items[0].description
101
- : null;
102
- const availableSortMethods = sortData
103
- ? sortData.products.sort_fields.options
104
- : null;
105
-
106
- useEffect(() => {
107
- if (!categoryLoading && categoryData.categories.items.length > 0) {
108
- dispatch({
109
- type: 'CATEGORY_PAGE_VIEW',
110
- payload: {
111
- id: categoryData.categories.items[0].uid,
112
- name: categoryData.categories.items[0].name,
113
- url_key: categoryData.categories.items[0].url_key,
114
- url_path: categoryData.categories.items[0].url_path
115
- }
116
- });
117
- }
118
- }, [categoryData, dispatch, categoryLoading]);
119
-
120
- return {
121
- availableSortMethods,
122
- categoryName,
123
- categoryDescription,
124
- filters,
125
- items,
126
- totalCount,
127
- totalPagesFromData
128
- };
129
- };