Skip to content

Commit

Permalink
Implementing the loading behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
neeshsilva committed Jan 5, 2021
1 parent 20b12ac commit 1cffb34
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Implemented loading behaviour for products comparison page.

### Changed
- Limit comparison bucket size and given it as app configuration parameter
- Enhance product comparison context to add array of items at once
Expand Down
16 changes: 9 additions & 7 deletions react/ComparisonPage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { ReactChildren, ReactChild } from 'react'
import { pathOr, isEmpty } from 'ramda'
import React, { ReactChild, ReactChildren } from 'react'
import { isEmpty, pathOr } from 'ramda'
import { useCssHandles } from 'vtex.css-handles'
import {
Button,
Layout,
PageHeader,
PageBlock,
Button,
PageHeader,
Spinner,
withToast,
// Dropdown,
} from 'vtex.styleguide'
import ComparisonContext from './ProductComparisonContext'
import { InjectedIntlProps, injectIntl, defineMessages } from 'react-intl'
import { defineMessages, InjectedIntlProps, injectIntl } from 'react-intl'
import './global.css'

const CSS_HANDLES = ['pageContainer', 'sortBy', 'removeAllItemsButtonWrapper']
Expand Down Expand Up @@ -80,7 +80,9 @@ const ComparisonPage = ({ children, intl, showToast }: Props) => {
}

return isEmpty(comparisonProducts) ? (
<div />
<div className={'mw3 center'}>
<Spinner />
</div>
) : (
<div className={`${cssHandles.pageContainer} mw9 center`}>
<Layout
Expand Down
20 changes: 20 additions & 0 deletions react/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,23 @@
padding: unset;
border: unset;
}

@-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}

.productLoader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #3498db;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite; /* Safari */
animation: spin 2s linear infinite;
}
1 change: 1 addition & 0 deletions react/typings/vtex.styleguide.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare module 'vtex.styleguide' {
export const PageHeader: ComponentType<InputProps>
export const PageBlock: ComponentType<InputProps>
export const ToastProvider: ComponentType<InputProps>
export const Spinner: ComponentType<InputProps>
export const ToastConsumer: ComponentType<InputProps>
export const Dropdown: ComponentType<InputProps>
export const withToast
Expand Down

0 comments on commit 1cffb34

Please sign in to comment.