-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add typing indicator animation #419
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e178ea3
Add typing indicator.
Vivihung e057fa8
Reorganize components
Vivihung ca1f1c2
Reorganize components
Vivihung d84e572
Add TS support to load SVG
Vivihung 8692d11
Merge branch 'main' into typing-indicator
Vivihung f275dd5
Update folder naming convention
Vivihung 8f15ff3
Merge branch 'main' into typing-indicator
Vivihung c5b9229
Merge branch 'main' into typing-indicator
adrianwyatt 5727513
Address PR feedback
Vivihung 84a0fd6
Merge branch 'typing-indicator' of https://github.com/Vivihung/semant…
Vivihung 080f4d2
Merge branch 'main' into typing-indicator
Vivihung 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 hidden or 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 hidden or 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,8 @@ | ||
| declare module '*.svg' { | ||
| import * as React from 'react'; | ||
|
|
||
| export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement> & { title?: string }>; | ||
|
|
||
| const src: string; | ||
| export default src; | ||
| } |
1 change: 1 addition & 0 deletions
1
samples/apps/copilot-chat-app/WebApp/src/assets/typing-balls-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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
34 changes: 34 additions & 0 deletions
34
...les/apps/copilot-chat-app/WebApp/src/components/chat/typing-indicator/TypingIndicator.tsx
This file contains hidden or 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,34 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| import { Image, makeStyles } from '@fluentui/react-components'; | ||
| import React from 'react'; | ||
| import typingBalls from '../../../assets/typing-balls-light.svg'; | ||
|
|
||
| const useStyles = makeStyles({ | ||
| root: { | ||
| contain: 'strict', | ||
| height: '28px', | ||
| overflowY: 'hidden', | ||
| width: '28px', | ||
| }, | ||
| image: { | ||
| animationDuration: '2.3s', | ||
| animationIterationCount: 'infinite', | ||
| animationName: { | ||
| from: { transform: 'translateY(0)' }, | ||
| // 28px Height * 68 Steps = 1904px | ||
| to: { transform: 'translateY(-1904px)' }, | ||
| }, | ||
| animationTimingFunction: 'steps(68)', | ||
| }, | ||
| }); | ||
|
|
||
| export const TypingIndicator: React.FC<{}> = () => { | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <div className={classes.root}> | ||
| <Image role="presentation" className={classes.image} src={typingBalls} /> | ||
| </div> | ||
| ); | ||
| }; |
30 changes: 30 additions & 0 deletions
30
.../copilot-chat-app/WebApp/src/components/chat/typing-indicator/TypingIndicatorRenderer.tsx
This file contains hidden or 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 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| import { Persona, makeStyles } from '@fluentui/react-components'; | ||
| import { Animation } from '@fluentui/react-northstar'; | ||
| import * as React from 'react'; | ||
| import { useAppSelector } from '../../../redux/app/hooks'; | ||
| import { RootState } from '../../../redux/app/store'; | ||
| import { TypingIndicator } from './TypingIndicator'; | ||
|
|
||
| const useClasses = makeStyles({ | ||
| root: { | ||
| display: 'flex', | ||
| flexDirection: 'row', | ||
| }, | ||
| }); | ||
|
|
||
| export const TypingIndicatorRenderer: React.FC = () => { | ||
| // TODO: Make this stateless React component. No need to connect to app state. | ||
| const { conversations, selectedId } = useAppSelector((state: RootState) => state.conversations); | ||
| const classes = useClasses(); | ||
|
|
||
| const typingIndicator = ( | ||
| <div className={classes.root}> | ||
| <Persona size="extra-small" avatar={{ image: { src: conversations[selectedId].botProfilePicture } }} /> | ||
| <TypingIndicator /> | ||
| </div> | ||
| ); | ||
|
|
||
| return <Animation name="slideInCubic" keyframeParams={{ distance: '2.4rem' }} children={typingIndicator} />; | ||
| }; |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -32,5 +32,5 @@ | |
| "types": [], | ||
| "composite": true | ||
| }, | ||
| "include": ["src"] | ||
| "include": ["src", "src/assets/custom.d.ts"] | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.