-
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.
new component Typing and added isMessageLoading in Conversation and u…
…pdate snaps
- Loading branch information
Juan Di Nella
committed
Oct 6, 2023
1 parent
b9118d6
commit a44744e
Showing
15 changed files
with
164 additions
and
98 deletions.
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
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,31 @@ | ||
import isPropValid from '@emotion/is-prop-valid' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import styles from './Typing.styles' | ||
/** | ||
* Typing | ||
*/ | ||
|
||
const shouldForwardProp = (prop) => isPropValid(prop) | ||
const StyledTyping = styled.div.withConfig({ shouldForwardProp })` | ||
${styles} | ||
` | ||
|
||
const Typing = ({ id }) => { | ||
return ( | ||
<StyledTyping css={styles} id={id} data-testid={id}> | ||
<span /> | ||
<span /> | ||
<span /> | ||
</StyledTyping> | ||
) | ||
} | ||
|
||
Typing.displayName = 'Typing' | ||
|
||
Typing.propTypes = { | ||
id: PropTypes.string, | ||
} | ||
|
||
export default Typing |
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,14 @@ | ||
import Typing from './Typing' | ||
|
||
import { getTemplate } from '../../../helpers/storybook' | ||
|
||
const Template = getTemplate(Typing) | ||
|
||
export default { | ||
title: 'Atoms/Typing', | ||
component: Typing, | ||
args: {}, | ||
argTypes: {}, | ||
} | ||
|
||
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,50 @@ | ||
import { css } from 'styled-components' | ||
|
||
export default css` | ||
padding: var(--spacing-xxs) var(--spacing-xs); | ||
font-size: var(--font-size-sm); | ||
max-width: max-content; | ||
white-space: pre-line; | ||
border-radius: var(--border-radius-md); | ||
line-height: 1.5; | ||
word-break: break-word; | ||
color: var(--color-neutral-900); | ||
background-color: var(--color-neutral-100); | ||
min-height: 37px; | ||
align-items: center; | ||
display: flex; | ||
gap: 5px; | ||
span { | ||
width: 10px; | ||
height: 10px; | ||
border-radius: var(--border-radius-round); | ||
animation: dots-animation 1.5s infinite ease-in-out; | ||
@media screen and (prefers-reduced-motion) { | ||
animation: none; | ||
} | ||
&:nth-child(1) { | ||
animation-delay: calc(300ms * 1); | ||
} | ||
&:nth-child(2) { | ||
animation-delay: calc(300ms * 2); | ||
} | ||
&:nth-child(3) { | ||
animation-delay: calc(300ms * 3); | ||
} | ||
@keyframes dots-animation { | ||
0% { | ||
background-color: var(--color-neutral-100); | ||
} | ||
20% { | ||
background-color: var(--color-neutral-400); | ||
} | ||
44% { | ||
background-color: var(--color-neutral-700); | ||
} | ||
} | ||
} | ||
` |
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,21 @@ | ||
import initStoryshots from '@storybook/addon-storyshots' | ||
import { render, screen, cleanup } from '@testing-library/react' | ||
import React from 'react' | ||
import Typing from './Typing' | ||
|
||
initStoryshots({ | ||
storyKindRegex: /^Atoms\/Typing$/, | ||
}) | ||
|
||
const componentProps = { | ||
id: 'unique_id', | ||
} | ||
afterEach(cleanup) | ||
|
||
describe('<Typing />', () => { | ||
test('should render component correctly', () => { | ||
render(<Typing {...componentProps} />) | ||
const comp = screen.getByTestId(componentProps.id) | ||
expect(comp).toBeInTheDocument() | ||
}) | ||
}) |
27 changes: 27 additions & 0 deletions
27
src/components/atoms/Typing/__snapshots__/Typing.test.js.snap
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,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Atoms/Typing Default 1`] = ` | ||
<div | ||
style={ | ||
{ | ||
"alignContent": "flex-start", | ||
"display": "flex", | ||
"flexDirection": "column", | ||
"flexWrap": "wrap", | ||
"gap": "10px 30px", | ||
"height": "100%", | ||
"justifyContent": "flex-start", | ||
"maxHeight": "auto", | ||
"position": "relative", | ||
} | ||
} | ||
> | ||
<div | ||
className="sc-1irqryg-0 sc-1irqryg-1 fyFnNP hSjpO" | ||
> | ||
<span /> | ||
<span /> | ||
<span /> | ||
</div> | ||
</div> | ||
`; |
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,3 @@ | ||
import Typing from './Typing' | ||
|
||
export default Typing |
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