Skip to content
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

feat: add shimmer effect to stop button #6816

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import type { ChatMessage } from '@sourcegraph/cody-shared'
import { CodyIDE } from '@sourcegraph/cody-shared'
import clsx from 'clsx'

import {
BetweenHorizonalEnd,
ChevronDown,
Expand Down Expand Up @@ -193,9 +194,9 @@ export const SubmitButton: FC<{
className={clsx(
'tw-px-6 tw-py-1',
'tw-rounded-full',
'tw-w-full tw-relative tw-border tw-border-button-border tw-box-content tw-bg-button-background hover:tw-bg-button-background-hover tw-text-button-foreground',

'disabled:tw-bg-button-secondary-background disabled:tw-text-muted-foreground'
'tw-w-full tw-relative tw-border tw-border-transparent tw-box-content tw-bg-button-background hover:tw-bg-button-background-hover tw-text-button-foreground',
'disabled:tw-bg-button-secondary-background disabled:tw-text-muted-foreground',
inProgress && processingAnimationClasses
)}
title={inProgress ? 'Stop' : 'Send'}
>
Expand All @@ -204,7 +205,7 @@ export const SubmitButton: FC<{
) : (
<Play className="tw-size-6 tw-fill-current" />
)}
</button>
</button>{' '}
</div>
)
}
Expand Down Expand Up @@ -331,7 +332,6 @@ export const SubmitButton: FC<{
</div>
)
}

export const PopoverItem: FunctionComponent<
PropsWithChildren<{
popoverContent: (close: () => void) => React.ReactNode
Expand Down Expand Up @@ -412,3 +412,20 @@ export const PopoverItem: FunctionComponent<
</Popover>
)
}

const processingAnimationClasses = clsx(
'tw-animate-fast-pulse',
'tw-relative',
'tw-border-transparent',
'tw-bg-button-background hover:tw-bg-button-background-hover',
'active:tw-scale-95',
'tw-transition-transform tw-duration-100',
'before:tw-absolute before:tw-inset-0',
'before:tw-rounded-full',
'before:tw-border',
'before:tw-border-transparent',
'before:tw-bg-[length:300%_100%]',
'before:tw-bg-gradient-to-r',
'before:tw-from-white/10 before:tw-via-transparent before:tw-to-white/10',
'before:tw-animate-border-travel-fast'
)
11 changes: 11 additions & 0 deletions vscode/webviews/tailwind.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,23 @@ export default {
from: { height: 'var(--radix-collapsible-content-height)' },
to: { height: '0' },
},
'fast-pulse': {
'0%, 100%': { opacity: '1' },
'50%': { opacity: '0.7' },
},
'border-travel': {
'0%': { 'background-position': '0% 50%' },
'100%': { 'background-position': '200% 50%' },
},
},
animation: {
'accordion-down': 'accordion-down 0.15s ease-out',
'accordion-up': 'accordion-up 0.15s ease-out',
'collapsible-down': 'collapsible-down 0.15s ease-out',
'collapsible-up': 'collapsible-up 0.15s ease-out',
'fast-pulse': 'fast-pulse 0.8s ease-in-out infinite',
'border-travel': 'border-travel 2s ease infinite',
'border-travel-fast': 'border-travel 1.2s linear infinite',
},
},
},
Expand Down
Loading