diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-02-23 18:11:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-23 18:11:37 +0100 |
| commit | 84903c1e5182124b1bb618b7d8754cb70d0a6647 (patch) | |
| tree | b9202449b4eb17d2ecd93ce53fef76b0eee81f15 /src/components/Buttons/ButtonHelp | |
| parent | c9b16994cd697b15ccb66be6879a119cf7bde7f7 (diff) | |
feat: improve Ackee tracking (#11)
* build(deps): add use-ackee hook package
* chore: create a context provider for Ackee
The provider allows users to change the 'detailed' settings.
* chore: add a select menu to choose which info to share with Ackee
* chore: add a tooltip for askee settings
* chore: replace default select styles with custom styles
* chore: register user choice in localstorage
* chore: replace Matomo with Ackee in legal notice
Diffstat (limited to 'src/components/Buttons/ButtonHelp')
| -rw-r--r-- | src/components/Buttons/ButtonHelp/ButtonHelp.module.scss | 52 | ||||
| -rw-r--r-- | src/components/Buttons/ButtonHelp/ButtonHelp.tsx | 41 |
2 files changed, 93 insertions, 0 deletions
diff --git a/src/components/Buttons/ButtonHelp/ButtonHelp.module.scss b/src/components/Buttons/ButtonHelp/ButtonHelp.module.scss new file mode 100644 index 0000000..b2a05d7 --- /dev/null +++ b/src/components/Buttons/ButtonHelp/ButtonHelp.module.scss @@ -0,0 +1,52 @@ +@use "@styles/abstracts/functions" as fun; +@use "@styles/abstracts/mixins" as mix; + +.icon { + color: var(--color-primary-dark); + font-weight: 600; +} + +.active { + .icon { + color: var(--color-fg-inverted); + } +} + +.wrapper { + width: fun.convert-px(44); + height: fun.convert-px(44); + background: var(--color-bg); + border: fun.convert-px(3) solid var(--color-primary-dark); + border-radius: 50%; + box-shadow: fun.convert-px(1) fun.convert-px(1) 0 0 var(--color-shadow); + transition: all 0.3s ease-in-out 0s; + + @include mix.pointer("fine") { + width: fun.convert-px(30); + height: fun.convert-px(30); + line-height: 1; + } + + &:hover, + &:focus { + border-color: var(--color-primary-light); + color: var(--color-primary-light); + box-shadow: fun.convert-px(1) fun.convert-px(1) fun.convert-px(1) + var(--color-shadow-light), + fun.convert-px(1) fun.convert-px(2) fun.convert-px(2) fun.convert-px(-2) + var(--color-shadow-light), + fun.convert-px(3) fun.convert-px(4) fun.convert-px(5) fun.convert-px(-4) + var(--color-shadow-light), + fun.convert-px(7) fun.convert-px(10) fun.convert-px(12) fun.convert-px(-3) + var(--color-shadow-light); + transform: scale(1.1); + + .icon { + transform: scale(1.1); + } + } + + &.active { + background: var(--color-primary); + } +} diff --git a/src/components/Buttons/ButtonHelp/ButtonHelp.tsx b/src/components/Buttons/ButtonHelp/ButtonHelp.tsx new file mode 100644 index 0000000..252e58c --- /dev/null +++ b/src/components/Buttons/ButtonHelp/ButtonHelp.tsx @@ -0,0 +1,41 @@ +import { SetStateAction } from 'react'; +import { useIntl } from 'react-intl'; +import styles from './ButtonHelp.module.scss'; + +const ButtonHelp = ({ + showHelp, + setShowHelp, + title, +}: { + showHelp: boolean; + setShowHelp: (value: SetStateAction<boolean>) => void; + title?: string; +}) => { + const intl = useIntl(); + + const handleClick = () => { + setShowHelp((prev) => !prev); + }; + + const activeModifier = showHelp ? styles.active : ''; + + return ( + <button + onClick={handleClick} + title={title} + className={`${styles.wrapper} ${activeModifier}`} + > + <span className={styles.icon} aria-hidden="true"> + ? + </span> + <span className="screen-reader-text"> + {intl.formatMessage({ + defaultMessage: 'Help', + description: 'ButtonHelp: screen reader text', + })} + </span> + </button> + ); +}; + +export default ButtonHelp; |
