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

Introduce new Spinner component #3786

Merged
merged 5 commits into from
Apr 24, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- add window titlebar for html_email- and help window #3770 #3778
- add quick key `Cmd+W`/`Ctrl+W` to close webxdc-, html_email- and help-window #3770 #3778
- Accept images from clipboard in QR reader #3762
- Introduce new `Spinner` component #3786

### Changed
- Update translations (2024-04-04) #3746
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/QrReader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import React, {
} from 'react'
import scanQrCode from 'jsqr'
import classNames from 'classnames'
import { Spinner } from '@blueprintjs/core'

import Icon from '../Icon'
import Spinner from '../Spinner'
import useTranslationFunction from '../../hooks/useTranslationFunction'
import { ContextMenuContext } from '../../contexts/ContextMenuContext'
import { ScreenContext } from '../../contexts/ScreenContext'
Expand Down
11 changes: 11 additions & 0 deletions src/renderer/components/Spinner/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react'

import styles from './styles.module.scss'

type Props = {
size?: number
}

export default function Spinner({ size = 50 }: Props) {
return <div style={{ width: `${size}px` }} className={styles.spinner} />
}
18 changes: 18 additions & 0 deletions src/renderer/components/Spinner/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@keyframes spin {
to {
transform: rotate(1turn);
}
}

.spinner {
aspect-ratio: 1;
background: var(--colorPrimary);
border-radius: 50%;
padding: 8px;
--_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;
-webkit-mask: var(--_m);
mask: var(--_m);
-webkit-mask-composite: source-out;
mask-composite: subtract;
animation: spin 1.5s infinite linear;
}
Loading