forked from samuellawerentz/style-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into CNTO-7751-TeamNameTag
- Loading branch information
Showing
9 changed files
with
175 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,66 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import './styles.scss' | ||
|
||
export const ChatLoader = ({ height, width, color, dotRadius, dotPositions, className }) => { | ||
return ( | ||
<svg height={height} width={width} className={`sg typing-loader ${className}`}> | ||
{dotPositions.map((pos) => ( | ||
<circle | ||
key={`${pos.cx}-${pos.cy}`} | ||
className="dot" | ||
cx={pos.cx} | ||
cy={pos.cy} | ||
r={dotRadius} | ||
style={{ fill: color }} | ||
/> | ||
))} | ||
</svg> | ||
) | ||
} | ||
|
||
ChatLoader.defaultProps = { | ||
className: '', | ||
height: '8', | ||
width: '36', | ||
color: 'grey', | ||
dotRadius: '4', | ||
dotPositions: [ | ||
{ cx: '4', cy: '4' }, | ||
{ cx: '18', cy: '4' }, | ||
{ cx: '32', cy: '4' }, | ||
], | ||
} | ||
|
||
// Prop types for type checking (optional) | ||
ChatLoader.propTypes = { | ||
/** | ||
* Class to be added | ||
*/ | ||
className: PropTypes.string, | ||
/** | ||
* This indicates height of the chat loader | ||
*/ | ||
height: PropTypes.string, | ||
/** | ||
* This indicates width of the chat loader | ||
*/ | ||
width: PropTypes.string, | ||
/** | ||
* This indicates color of the cirlce | ||
*/ | ||
color: PropTypes.string, | ||
/** | ||
* This indicates radius of the circle | ||
*/ | ||
dotRadius: PropTypes.string, | ||
/** | ||
* This indicates dotPositions , cx and cy denoted x and y coordinated of the circle | ||
*/ | ||
dotPositions: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
cx: PropTypes.string.isRequired, | ||
cy: PropTypes.string.isRequired, | ||
}), | ||
), | ||
} |
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,12 @@ | ||
import React from 'react' | ||
import { ChatLoader } from '.' | ||
|
||
export default { | ||
title: 'Components/ChatLoader', | ||
component: ChatLoader, | ||
parameters: {}, | ||
} | ||
|
||
const Template = (args) => <ChatLoader {...args} /> | ||
|
||
export const Default = Template.bind({}) |
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,25 @@ | ||
// Chat Loader.scss | ||
|
||
.sg.typing-loader { | ||
background-color: #f1f1f1; | ||
color: var(--gray-3); | ||
|
||
.dot { | ||
animation: 1s sg-typing-blink infinite; | ||
fill: var(--gray-3); | ||
} | ||
.dot:nth-child(2) { | ||
animation-delay: 250ms; | ||
} | ||
|
||
.dot:nth-child(3) { | ||
animation-delay: 500ms; | ||
} | ||
|
||
} | ||
|
||
@keyframes sg-typing-blink { | ||
50% { | ||
fill: transparent; | ||
} | ||
} |
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