-
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 all 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"], | ||
"plugins": ["@babel/plugin-proposal-class-properties"] | ||
"plugins": ["@babel/plugin-proposal-class-properties"], | ||
"env": { | ||
"development": { | ||
"compact": false | ||
} | ||
} | ||
} |
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
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,107 @@ | ||
@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 lineShimmer($length: 80px, $duration: 1s, $timingFunction: linear) { | ||
animation-duration: $duration; | ||
animation-fill-mode: forwards; | ||
animation-iteration-count: infinite; | ||
animation-name: placeholderShimmer; | ||
animation-timing-function: $timingFunction; | ||
|
||
-webkit-animation-duration: $duration; | ||
-webkit-animation-fill-mode: forwards; | ||
-webkit-animation-iteration-count: infinite; | ||
-webkit-animation-name: placeholderShimmer; | ||
-webkit-animation-timing-function: $timingFunction; | ||
|
||
@keyframes placeholderShimmer { | ||
0% { | ||
background-position: -700px 0; | ||
} | ||
100% { | ||
background-position: 700px 0; | ||
} | ||
} | ||
|
||
@-webkit-keyframes placeholderShimmer { | ||
0% { | ||
background-position: -700px 0; | ||
} | ||
100% { | ||
background-position: 700px 0; | ||
} | ||
} | ||
} | ||
|
||
@mixin boxShimmer($length: 80px, $duration: 1s, $timingFunction: linear) { | ||
animation-duration: $duration; | ||
animation-fill-mode: forwards; | ||
animation-iteration-count: infinite; | ||
animation-name: boxPlaceholderShimmer; | ||
animation-timing-function: $timingFunction; | ||
|
||
-webkit-animation-duration: $duration; | ||
-webkit-animation-fill-mode: forwards; | ||
-webkit-animation-iteration-count: infinite; | ||
-webkit-animation-name: boxPlaceholderShimmer; | ||
-webkit-animation-timing-function: $timingFunction; | ||
|
||
@keyframes boxPlaceholderShimmer { | ||
0% { | ||
background-position: -80px 0; | ||
} | ||
100% { | ||
background-position: 80px 0; | ||
} | ||
} | ||
|
||
@-webkit-keyframes boxPlaceholderShimmer { | ||
0% { | ||
background-position: -80px 0; | ||
} | ||
100% { | ||
background-position: 80px 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(['square', 'circle']), | ||
}; | ||
|
||
BoxPlaceholder.defaultProps = { | ||
theme: {}, | ||
shape: 'square', | ||
}; | ||
|
||
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,74 @@ | ||
## Box Placeholder | ||
|
||
The box placeholder component. | ||
|
||
### Properties | ||
|
||
| Name | Type | Default | Description | | ||
| :------ | :------- | :-------- | :---------------------------- | | ||
| `shape` | `String` | `square` | Prop to set the shape of box. Circle or Square. | | ||
|
||
### Theme | ||
|
||
| Name | Description | | ||
| :---------- | :---------------------------------------- | | ||
| `boxStyles` | Class used for the style the box element. | | ||
|
||
### Usage | ||
|
||
``` | ||
|
||
class Demo extends React.Component { | ||
state = { | ||
loading: false, | ||
} | ||
render() { | ||
const {loading} = this.state; | ||
return ( | ||
<div> | ||
{ loading ? <BoxPlaceholder theme={boxPlaceholderTheme} shape={boxShape} /> : | ||
<div>User Content</div> | ||
</div> | ||
) | ||
} | ||
} | ||
``` | ||
|
||
|
||
### You can make custom card placeholder by putting together box and line placeholder. | ||
|
||
``` | ||
|
||
const CustomPlaceholder = () => ( | ||
<div style={{ | ||
margin: "8px", | ||
padding: "16px" | ||
}}> | ||
<div style={{ | ||
display: "flex", | ||
alignItems: "center" | ||
}}> | ||
<BoxPlaceholder /> | ||
<LinePlaceholder lineWidth="75" /> | ||
</div> | ||
|
||
<LinePlaceholder lineWidth="50" /> | ||
<LinePlaceholder lineWidth="25" /> | ||
</div> | ||
) | ||
|
||
class Demo extends React.Component { | ||
state = { | ||
loading: false, | ||
} | ||
render() { | ||
const {loading} = this.state; | ||
return ( | ||
<div> | ||
{ loading ? <CustomPlaceholder /> : | ||
<div>User Content</div> | ||
</div> | ||
) | ||
} | ||
} | ||
KRRISH96 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` |
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