-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add placeholders #337
Closed
Closed
add placeholders #337
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
0e0da4d
add placeholders
3e36750
add lineWidth in text placeholder
83a412d
add placeholders tests
2c322f4
add readMe.md files
07e1bd8
fix readMe.md of box placeholder
321bd4c
fix formatting
977c477
fix readMe.md files
1309bc5
fix usage in MD files
1d307b7
change shape prop in box place holder from defult to square
c37db69
fix tests in box placeholder
676a95c
build(dev): greatly improves rebuild times (#338)
rishichawda 6f3be8b
add placeholders
1f30801
add lineWidth in text placeholder
a667ea2
add placeholders tests
6045ab8
add readMe.md files
c5b0ed4
fix readMe.md of box placeholder
2cc065e
fix formatting
394c18e
fix readMe.md files
723ba6c
fix usage in MD files
8af3073
change shape prop in box place holder from defult to square
d248faa
fix tests in box placeholder
6103e9a
add existing card component in card placeholder and update Md files a…
1e1c449
merge changes
b483717
fix shimmer speed and length
3541a1d
fix tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ coverage | |
.nyc_output | ||
/dist | ||
/stats | ||
/components | ||
/components | ||
/yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,75 @@ | ||
@mixin inputFocus() { | ||
-o-animation-name: animateFocus; | ||
-moz-animation-name: animateFocus; | ||
-webkit-animation-name: animateFocus; | ||
animation-name: animateFocus; | ||
@keyframes animateFocus { | ||
0% { | ||
width: 0%; | ||
} | ||
100% { | ||
width: 100%; | ||
} | ||
-o-animation-name: animateFocus; | ||
-moz-animation-name: animateFocus; | ||
-webkit-animation-name: animateFocus; | ||
animation-name: animateFocus; | ||
@keyframes animateFocus { | ||
0% { | ||
width: 0%; | ||
} | ||
|
||
100% { | ||
width: 100%; | ||
} | ||
} | ||
} | ||
|
||
@mixin zoomIn() { | ||
-o-animation-name: animateZoom; | ||
-moz-animation-name: animateZoom; | ||
-webkit-animation-name: animateZoom; | ||
animation-name: animateZoom; | ||
@keyframes animateZoom { | ||
0% { | ||
transform: scale(0.1); | ||
} | ||
100% { | ||
transform: scale(1); | ||
} | ||
-o-animation-name: animateZoom; | ||
-moz-animation-name: animateZoom; | ||
-webkit-animation-name: animateZoom; | ||
animation-name: animateZoom; | ||
@keyframes animateZoom { | ||
0% { | ||
transform: scale(0.1); | ||
} | ||
100% { | ||
transform: scale(1); | ||
} | ||
} | ||
} | ||
|
||
@mixin sectionEntry($duration) { | ||
visibility: hidden; | ||
opacity: 0; | ||
transform: translate(0, 10px) perspective(200px) rotateX(-2deg); | ||
&.enabled { | ||
visibility: visible; | ||
opacity: 1; | ||
transition: visibility $duration, opacity $duration, transform $duration; | ||
transform: translate(0, 0); | ||
visibility: hidden; | ||
opacity: 0; | ||
transform: translate(0, 10px) perspective(200px) rotateX(-2deg); | ||
|
||
&.enabled { | ||
visibility: visible; | ||
opacity: 1; | ||
transition: visibility $duration, opacity $duration, transform $duration; | ||
transform: translate(0, 0); | ||
} | ||
} | ||
|
||
@mixin shimmer($duration: 2s) { | ||
animation-duration: $duration; | ||
animation-fill-mode: forwards; | ||
animation-iteration-count: infinite; | ||
animation-name: placeholderShimmer; | ||
animation-timing-function: linear; | ||
|
||
-webkit-animation-duration: 1s; | ||
-webkit-animation-fill-mode: forwards; | ||
-webkit-animation-iteration-count: infinite; | ||
-webkit-animation-name: placeholderShimmer; | ||
-webkit-animation-timing-function: linear; | ||
|
||
@keyframes placeholderShimmer { | ||
0% { | ||
background-position: -468px 0; | ||
} | ||
100% { | ||
background-position: 468px 0; | ||
} | ||
} | ||
|
||
@-webkit-keyframes placeholderShimmer { | ||
0% { | ||
background-position: -468px 0; | ||
} | ||
100% { | ||
background-position: 468px 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
import { themr } from 'react-css-themr'; | ||
|
||
import '../../globals/fonts.scss'; | ||
import defaultTheme from './theme.module.scss'; | ||
|
||
const BoxPlaceholder = ({ theme, shape }) => { | ||
const classes = classnames(theme.styles, theme.boxStyles, theme[shape]); | ||
|
||
const boxPlaceholderProps = { | ||
className: classes, | ||
}; | ||
|
||
return <div {...boxPlaceholderProps} />; | ||
}; | ||
|
||
BoxPlaceholder.propTypes = { | ||
theme: PropTypes.shape({}), | ||
shape: PropTypes.oneOf(['default', 'circle']), | ||
}; | ||
|
||
BoxPlaceholder.defaultProps = { | ||
theme: {}, | ||
shape: 'default', | ||
}; | ||
|
||
export default themr('BPLACEHOLDER', defaultTheme)(BoxPlaceholder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
## Box Placeholder | ||
|
||
The box placeholder component. | ||
|
||
### Properties | ||
|
||
| Name | Type | Default | Description | | ||
| :------ | :------- | :-------- | :---------------------------- | | ||
| `shape` | `String` | `default` | Prop to set the shape of box. | | ||
|
||
### Theme | ||
|
||
| Name | Description | | ||
| :---------- | :---------------------------------------- | | ||
| `boxStyles` | Class used for the style the box element. | | ||
|
||
### Usage | ||
|
||
``` | ||
|
||
const Demo = ({theme, shape}) => { | ||
const classes = classnames(theme.styles, theme.boxStyles, theme[shape]); | ||
|
||
const boxPlaceholderProps = { | ||
className: classes, | ||
}; | ||
|
||
return <div {...boxPlaceholderProps} />; | ||
} | ||
KRRISH96 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { expect, assert } from 'chai'; | ||
|
||
import BoxPlaceholder from '..'; | ||
|
||
/* eslint-disable no-undef */ | ||
describe('BoxPlaceholder accessibility tests', () => { | ||
let wrappedComponent; | ||
let expectedValue; | ||
let actualValue; | ||
|
||
beforeEach(() => { | ||
wrappedComponent = mount(<BoxPlaceholder shape="circle" />); | ||
}); | ||
|
||
afterEach(() => { | ||
wrappedComponent.unmount(); | ||
}); | ||
|
||
it('allows us to set props', () => { | ||
expect(wrappedComponent.props().shape).to.equal('circle'); | ||
wrappedComponent.setProps({ shape: 'default' }); | ||
expect(wrappedComponent.props().shape).to.equal('default'); | ||
}); | ||
|
||
it('should accept `Shape` prop', () => { | ||
expectedValue = 'circle'; | ||
actualValue = () => wrappedComponent.prop('shape'); | ||
assert.strictEqual(actualValue(), expectedValue); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { expect } from 'chai'; | ||
|
||
import BoxPlaceHolder from '..'; | ||
|
||
/* eslint-disable no-undef */ | ||
describe('Box placeholder render test', () => { | ||
let wrappedComponent; | ||
const expectedValue = 1; | ||
const actualValue = element => wrappedComponent.find(element).length; | ||
|
||
beforeEach(() => { | ||
wrappedComponent = mount(<BoxPlaceHolder />); | ||
}); | ||
|
||
afterEach(() => { | ||
wrappedComponent.unmount(); | ||
}); | ||
|
||
it('Should render the BoxPlaceholder component', () => { | ||
expect(actualValue('div')).equal(expectedValue); | ||
}); | ||
|
||
it('Should render a `BoxPlaceholder` with defalult `shape`', () => { | ||
expect(wrappedComponent.props().shape).to.equal('default'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@import '../../globals/theme'; | ||
@import '../../globals/animations.module.scss'; | ||
|
||
:local(.styles) { | ||
background: $shimmer-color-light; | ||
background-image: linear-gradient( | ||
to right, | ||
$shimmer-color-light 0%, | ||
$shimmer-color-dark 20%, | ||
$shimmer-color-light 40%, | ||
$shimmer-color-light 100% | ||
); | ||
background-repeat: no-repeat; | ||
// **** change here for height *** | ||
// background-size: 800px 80px; | ||
display: inline-block; | ||
position: relative; | ||
|
||
@include shimmer(); | ||
} | ||
|
||
:local(.boxStyles) { | ||
width: 80px; | ||
height: 80px; | ||
} | ||
|
||
:local(.circle) { | ||
border-radius: 100px; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was due to prettier. Can you try removing prettier and lint files with eslint and see if it reverts these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
321bd4c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0e0da4d