Skip to content

Commit

Permalink
Introduce new Spinner component (#3786)
Browse files Browse the repository at this point in the history
* Introduce new Spinner component:

* Add entry to CHANGELOG.md

* Make linter happy

* Remove accidentially added file

* Remove accidentially added file
  • Loading branch information
adzialocha authored Apr 24, 2024
1 parent 070e40c commit 1f15286
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
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;
}

0 comments on commit 1f15286

Please sign in to comment.