├── .babelrc ├── .editorconfig ├── .github └── dependabot.yml ├── .gitignore ├── .npmrc ├── .storybook ├── addons.js └── config.js ├── .travis.yml ├── CHANGELOG.md ├── README.md ├── demo.gif ├── package.json ├── rollup.config.js ├── src ├── components │ ├── ClapButton.js │ ├── ClapCount.js │ ├── ClapCountTotal.js │ ├── ClapIcon.js │ ├── ClapWrap.js │ └── ClearClaps.js ├── index.js └── utils.js └── stories └── index.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "production": { 4 | "plugins": [ 5 | ["transform-react-remove-prop-types", {"removeImport": true}], 6 | "transform-react-pure-class-to-function", 7 | "@babel/plugin-transform-react-constant-elements" 8 | ] 9 | } 10 | }, 11 | "presets": [ 12 | ["@babel/preset-env", { 13 | "targets": { "browsers": [ 14 | ">0.25%", 15 | "not ie 11", 16 | "not op_mini all" 17 | ] } 18 | }], 19 | "@babel/preset-react" 20 | ], 21 | "plugins": [ 22 | "@babel/plugin-proposal-class-properties", 23 | "@babel/plugin-proposal-object-rest-spread" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 2 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | max_line_length = 100 13 | indent_brace_style = 1TBS 14 | spaces_around_operators = true 15 | quote_type = auto 16 | 17 | [package.json] 18 | indent_style = space 19 | indent_size = 2 20 | 21 | [*.md] -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | - package-ecosystem: "github-actions" 8 | directory: "/" 9 | schedule: 10 | # Check for updates to GitHub Actions every weekday 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | storybook-static 4 | dist 5 | .envrc 6 | stats.html 7 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | unsafe-perm=true 2 | save-prefix=~ 3 | shrinkwrap=false 4 | save=false -------------------------------------------------------------------------------- /.storybook/addons.js: -------------------------------------------------------------------------------- 1 | import '@storybook/addon-options/register' 2 | import '@storybook/addon-viewport/register' 3 | import 'storybook-addon-jsx/register' 4 | -------------------------------------------------------------------------------- /.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { setAddon, configure } from '@storybook/react' 2 | import { setOptions } from '@storybook/addon-options' 3 | import JSXAddon from 'storybook-addon-jsx' 4 | 5 | function loadStories () { 6 | require('../stories') 7 | } 8 | 9 | setAddon(JSXAddon) 10 | 11 | setOptions({ 12 | name: 'react-clap-button', 13 | url: 'https://github.com/Kikobeats/react-clap-button', 14 | goFullScreen: false, 15 | showStoriesPanel: true, 16 | showAddonPanel: true, 17 | showSearchBox: false, 18 | addonPanelInRight: true, 19 | sortStoriesByKind: false 20 | }) 21 | 22 | configure(loadStories, module) 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - lts/* 5 | 6 | stages: 7 | - Test 8 | - name: Release 9 | if: branch = master AND commit_message !~ /(release|no-release)/ 10 | 11 | jobs: 12 | include: 13 | - stage: Release 14 | node_js: lts/* 15 | install: npm install --no-package-lock 16 | before_deploy: 17 | - git config user.email ${GITHUB_EMAIL:-"travis@travis-ci.org"} 18 | - git config user.name ${GITHUB_USER:-"Travis CI"} 19 | - git remote set-url origin https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git 20 | - git checkout master 21 | deploy: 22 | skip_cleanup: true 23 | provider: script 24 | script: npm run release 25 | on: 26 | branch: master 27 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [1.2.12](https://github.com/kikobeats/react-clap-button/compare/v1.2.11...v1.2.12) (2020-10-24) 6 | 7 | ### [1.2.11](https://github.com/kikobeats/react-clap-button/compare/v1.2.10...v1.2.11) (2020-10-05) 8 | 9 | ### [1.2.10](https://github.com/kikobeats/react-clap-button/compare/v1.2.9...v1.2.10) (2020-09-07) 10 | 11 | ### [1.2.9](https://github.com/kikobeats/react-clap-button/compare/v1.2.8...v1.2.9) (2020-05-04) 12 | 13 | ### [1.2.8](https://github.com/kikobeats/react-clap-button/compare/v1.2.7...v1.2.8) (2020-04-07) 14 | 15 | ### [1.2.7](https://github.com/kikobeats/react-clap-button/compare/v1.2.6...v1.2.7) (2020-03-31) 16 | 17 | ### [1.2.6](https://github.com/kikobeats/react-clap-button/compare/v1.2.5...v1.2.6) (2020-03-26) 18 | 19 | ### [1.2.5](https://github.com/kikobeats/react-clap-button/compare/v1.2.4...v1.2.5) (2020-02-12) 20 | 21 | ### [1.2.4](https://github.com/kikobeats/react-clap-button/compare/v1.2.3...v1.2.4) (2020-02-09) 22 | 23 | ### [1.2.3](https://github.com/kikobeats/react-clap-button/compare/v1.2.2...v1.2.3) (2020-02-09) 24 | 25 | ### [1.2.2](https://github.com/kikobeats/react-clap-button/compare/v1.2.1...v1.2.2) (2020-02-09) 26 | 27 | ### [1.2.1](https://github.com/kikobeats/react-clap-button/compare/v1.2.0...v1.2.1) (2020-02-09) 28 | 29 | ## [1.2.0](https://github.com/kikobeats/react-clap-button/compare/v1.1.5...v1.2.0) (2020-02-09) 30 | 31 | 32 | ### Features 33 | 34 | * fix SSR ([deceadd](https://github.com/kikobeats/react-clap-button/commit/deceadd2b7490ab93b023ab4243dc46e27c98127)) 35 | 36 | ### [1.1.5](https://github.com/kikobeats/react-clap-button/compare/v1.1.4...v1.1.5) (2019-10-23) 37 | 38 | ### [1.1.4](https://github.com/kikobeats/react-clap-button/compare/v1.1.3...v1.1.4) (2019-10-23) 39 | 40 | 41 | ### Bug Fixes 42 | 43 | * add postinstall script ([688dcd7](https://github.com/kikobeats/react-clap-button/commit/688dcd744ff7209658c5e2d3483b143a421155c6)), closes [#45](https://github.com/kikobeats/react-clap-button/issues/45) 44 | 45 | ### 1.1.3 (2019-10-11) 46 | 47 | ### 1.1.2 (2019-10-11) 48 | 49 | ### 1.1.1 (2019-10-10) 50 | 51 | ## 1.1.0 (2019-10-10) 52 | 53 | 54 | ### Bug Fixes 55 | 56 | * **package:** update polished to version 2.3.0 ([212adce](https://github.com/kikobeats/react-clap-button/commit/212adce17c2c026cdaaf1a6795f55b2e14961987)) 57 | * **package:** update polished to version 3.0.0 ([3a6348c](https://github.com/kikobeats/react-clap-button/commit/3a6348cab2c7c2f04e98624506b354d02f25ef2e)) 58 | * **package:** update polished to version 3.1.0 ([275c5e6](https://github.com/kikobeats/react-clap-button/commit/275c5e6ce5bc3e6a9b151c10f880e33ef2c59aae)) 59 | * **package:** update react-transition-group to version 3.0.0 ([8759f29](https://github.com/kikobeats/react-clap-button/commit/8759f294282f4c1c1aabe540fa8aa0a806a8b446)) 60 | * **package:** update react-transition-group to version 4.0.0 ([e76d863](https://github.com/kikobeats/react-clap-button/commit/e76d863a08f4036d81e8f0dbb3674a9abae66219)) 61 | * **package:** update styled-components to version 4.1.0 ([dda01e0](https://github.com/kikobeats/react-clap-button/commit/dda01e03887adb55ba9364661f7840d23a8cd44a)) 62 | * **package:** update styled-components to version 4.2.0 ([372d473](https://github.com/kikobeats/react-clap-button/commit/372d4738e35f2604cb18814945965363f57f85eb)) 63 | * **package:** update styled-components to version 4.3.0 ([d5bb878](https://github.com/kikobeats/react-clap-button/commit/d5bb87861a76a7f1582533af64e6eaa7a6a43b9c)) 64 | 65 | ### 1.0.8 (2018-10-18) 66 | 67 | ### 1.0.7 (2018-10-18) 68 | 69 | 70 | ### Bug Fixes 71 | 72 | * **package:** update polished to version 2.0.1 ([228c8ee](https://github.com/kikobeats/react-clap-button/commit/228c8eeb4117230dcd3d6eccff8367f2f9c8ef79)) 73 | * **package:** update polished to version 2.1.0 ([9e649a6](https://github.com/kikobeats/react-clap-button/commit/9e649a62a513894def705912c152c5cb50ecb5ad)) 74 | * **package:** update styled-components to version 3.3.0 ([b4df56f](https://github.com/kikobeats/react-clap-button/commit/b4df56fbd3af5d894d6efbdf3b1b23ce742aa0c0)) 75 | * **package:** update styled-components to version 3.4.0 ([eb0574e](https://github.com/kikobeats/react-clap-button/commit/eb0574e60452435e51717f5ceb73018bb1313440)) 76 | * **package:** update styled-components to version 4.0.0 ([849c0d5](https://github.com/kikobeats/react-clap-button/commit/849c0d5dc466fc320ad11ddd50aef9c571aed1fa)) 77 | 78 | ### 1.0.6 (2018-04-26) 79 | 80 | ### 1.0.5 (2018-03-17) 81 | 82 | ### 1.0.4 (2018-03-07) 83 | 84 | 85 | ### Bug Fixes 86 | 87 | * **package:** update styled-components to version 3.2.0 ([a076193](https://github.com/kikobeats/react-clap-button/commit/a0761936ec55b3bfbaa902f9a202a76a1ffec393)) 88 | 89 | ### 1.0.3 (2018-03-04) 90 | 91 | 92 | ## 1.1.2 (2019-10-11) 93 | 94 | * Using Ref based element selection instead of ids ([c3c1165](https://github.com/kikobeats/react-clap-button/commit/c3c1165)) 95 | 96 | 97 | 98 | 99 | ## 1.1.1 (2019-10-10) 100 | 101 | * Nano bug fix. ([adeb5a9](https://github.com/kikobeats/react-clap-button/commit/adeb5a9)) 102 | 103 | 104 | 105 | 106 | # 1.1.0 (2019-10-10) 107 | 108 | * build: add contributors ([18600cd](https://github.com/kikobeats/react-clap-button/commit/18600cd)) 109 | * build: update dependencies ([c2e4b43](https://github.com/kikobeats/react-clap-button/commit/c2e4b43)) 110 | * callback for count change ([2d1b7f7](https://github.com/kikobeats/react-clap-button/commit/2d1b7f7)) 111 | * Update README.md ([e111441](https://github.com/kikobeats/react-clap-button/commit/e111441)) 112 | * fix(package): update polished to version 2.3.0 ([212adce](https://github.com/kikobeats/react-clap-button/commit/212adce)) 113 | * fix(package): update polished to version 3.0.0 ([3a6348c](https://github.com/kikobeats/react-clap-button/commit/3a6348c)) 114 | * fix(package): update polished to version 3.1.0 ([275c5e6](https://github.com/kikobeats/react-clap-button/commit/275c5e6)) 115 | * fix(package): update react-transition-group to version 3.0.0 ([8759f29](https://github.com/kikobeats/react-clap-button/commit/8759f29)) 116 | * fix(package): update react-transition-group to version 4.0.0 ([e76d863](https://github.com/kikobeats/react-clap-button/commit/e76d863)) 117 | * fix(package): update styled-components to version 4.1.0 ([dda01e0](https://github.com/kikobeats/react-clap-button/commit/dda01e0)) 118 | * fix(package): update styled-components to version 4.2.0 ([372d473](https://github.com/kikobeats/react-clap-button/commit/372d473)) 119 | * fix(package): update styled-components to version 4.3.0 ([d5bb878](https://github.com/kikobeats/react-clap-button/commit/d5bb878)) 120 | 121 | 122 | 123 | 124 | ## 1.0.8 (2018-10-18) 125 | 126 | * Migrate husky ([ad1301a](https://github.com/kikobeats/react-clap-button/commit/ad1301a)) 127 | * Update polished ([61b58cd](https://github.com/kikobeats/react-clap-button/commit/61b58cd)) 128 | 129 | 130 | 131 | 132 | ## 1.0.7 (2018-10-18) 133 | 134 | * fix(package): update polished to version 2.0.1 ([228c8ee](https://github.com/kikobeats/react-clap-button/commit/228c8ee)) 135 | * fix(package): update polished to version 2.1.0 ([9e649a6](https://github.com/kikobeats/react-clap-button/commit/9e649a6)) 136 | * fix(package): update styled-components to version 3.3.0 ([b4df56f](https://github.com/kikobeats/react-clap-button/commit/b4df56f)) 137 | * fix(package): update styled-components to version 3.4.0 ([eb0574e](https://github.com/kikobeats/react-clap-button/commit/eb0574e)) 138 | * fix(package): update styled-components to version 4.0.0 ([849c0d5](https://github.com/kikobeats/react-clap-button/commit/849c0d5)) 139 | * Update package.json ([90c5481](https://github.com/kikobeats/react-clap-button/commit/90c5481)) 140 | 141 | 142 | 143 | 144 | ## 1.0.6 (2018-04-26) 145 | 146 | * Add better browser targets ([512614b](https://github.com/kikobeats/react-clap-button/commit/512614b)) 147 | * Remove final bundle from repository ([debb47f](https://github.com/kikobeats/react-clap-button/commit/debb47f)) 148 | 149 | 150 | 151 | 152 | ## 1.0.5 (2018-03-17) 153 | 154 | * Add `onClickClear` method ([a2acecf](https://github.com/kikobeats/react-clap-button/commit/a2acecf)) 155 | * Add count story ([7d159aa](https://github.com/kikobeats/react-clap-button/commit/7d159aa)) 156 | * Add different timing after click ([9e4741a](https://github.com/kikobeats/react-clap-button/commit/9e4741a)) 157 | * Add missing precommit script ([c0c4136](https://github.com/kikobeats/react-clap-button/commit/c0c4136)) 158 | * Adjust space ([7846a1f](https://github.com/kikobeats/react-clap-button/commit/7846a1f)) 159 | * Adjust timing ([1115c40](https://github.com/kikobeats/react-clap-button/commit/1115c40)) 160 | * Create initial components for “clear results” ([cc19dd1](https://github.com/kikobeats/react-clap-button/commit/cc19dd1)) 161 | * Fix `onClickClear` method ([3610e96](https://github.com/kikobeats/react-clap-button/commit/3610e96)) 162 | * Hide `ClapCountTotal` when total === 0 ([e855c54](https://github.com/kikobeats/react-clap-button/commit/e855c54)) 163 | * Improve animation ([e241bb9](https://github.com/kikobeats/react-clap-button/commit/e241bb9)) 164 | * Improve hover effect ([74ec2e3](https://github.com/kikobeats/react-clap-button/commit/74ec2e3)) 165 | * Modify timing ([67b676e](https://github.com/kikobeats/react-clap-button/commit/67b676e)) 166 | * Remove size-limit ([a8caf29](https://github.com/kikobeats/react-clap-button/commit/a8caf29)) 167 | * Update “color” stories primaryColor ([ef83aaa](https://github.com/kikobeats/react-clap-button/commit/ef83aaa)) 168 | * Update ClearClaps ([585f45e](https://github.com/kikobeats/react-clap-button/commit/585f45e)) 169 | * Update ClearClaps transition ([78d83d9](https://github.com/kikobeats/react-clap-button/commit/78d83d9)) 170 | * Update demo ([ee19daf](https://github.com/kikobeats/react-clap-button/commit/ee19daf)) 171 | 172 | 173 | 174 | 175 | ## 1.0.4 (2018-03-07) 176 | 177 | * Fix storybook custom icon size ([1f83242](https://github.com/kikobeats/react-clap-button/commit/1f83242)) 178 | * Fix storybook ecamples ([543dc61](https://github.com/kikobeats/react-clap-button/commit/543dc61)) 179 | * Fix theme prop ([54bade6](https://github.com/kikobeats/react-clap-button/commit/54bade6)) 180 | * Fixes ([2bd6713](https://github.com/kikobeats/react-clap-button/commit/2bd6713)) 181 | * Misc. formatting updates ([7172e03](https://github.com/kikobeats/react-clap-button/commit/7172e03)) 182 | * Misc. refactor icon ([ce32b0d](https://github.com/kikobeats/react-clap-button/commit/ce32b0d)) 183 | * Refactoring ([e996106](https://github.com/kikobeats/react-clap-button/commit/e996106)) 184 | * Smoother glow animation ([a937f9d](https://github.com/kikobeats/react-clap-button/commit/a937f9d)) 185 | * Update `getTheme` method ([f284a40](https://github.com/kikobeats/react-clap-button/commit/f284a40)) 186 | * Update icon example in storybook to `ThumbsUp` icon ([d00ab66](https://github.com/kikobeats/react-clap-button/commit/d00ab66)) 187 | * fix(package): update styled-components to version 3.2.0 ([a076193](https://github.com/kikobeats/react-clap-button/commit/a076193)) 188 | 189 | 190 | 191 | 192 | ## 1.0.3 (2018-03-04) 193 | 194 | * Adjust border transition ([46cf183](https://github.com/kikobeats/react-clap-button/commit/46cf183)) 195 | * Disable clicks on count numbers ([ee2b9dd](https://github.com/kikobeats/react-clap-button/commit/ee2b9dd)) 196 | * Disable text-highlighting ([a427e08](https://github.com/kikobeats/react-clap-button/commit/a427e08)) 197 | * Update index.js ([bdaaaab](https://github.com/kikobeats/react-clap-button/commit/bdaaaab)) 198 | * Update README ([23f7c8f](https://github.com/kikobeats/react-clap-button/commit/23f7c8f)) 199 | * Update release scripts ([bd18d70](https://github.com/kikobeats/react-clap-button/commit/bd18d70)) 200 | 201 | 202 | 203 | 204 | ## 1.0.2 (2018-02-23) 205 | 206 | * Fix warning ([7730f4a](https://github.com/kikobeats/react-clap-button/commit/7730f4a)) 207 | * Improve storybook ([cb50e81](https://github.com/kikobeats/react-clap-button/commit/cb50e81)) 208 | * Increment count if clicks is under total ([a135f19](https://github.com/kikobeats/react-clap-button/commit/a135f19)), closes [#5](https://github.com/kikobeats/react-clap-button/issues/5) 209 | * Prop destructuring ([6108b09](https://github.com/kikobeats/react-clap-button/commit/6108b09)) 210 | 211 | 212 | 213 | 214 | ## 1.0.1 (2018-02-20) 215 | 216 | * Add `backface-visibility` css property ([d48aa20](https://github.com/kikobeats/react-clap-button/commit/d48aa20)) 217 | * Rename ([e827541](https://github.com/kikobeats/react-clap-button/commit/e827541)) 218 | * Update demo.gif ([de3a62c](https://github.com/kikobeats/react-clap-button/commit/de3a62c)) 219 | * Update README.md ([223e448](https://github.com/kikobeats/react-clap-button/commit/223e448)) 220 | 221 | 222 | 223 | 224 | # 1.0.0 (2018-02-20) 225 | 226 | * First commit ([083709e](https://github.com/kikobeats/react-clap-button/commit/083709e)) 227 | * Lint package ([4e40edc](https://github.com/kikobeats/react-clap-button/commit/4e40edc)) 228 | * Remove ncu ([c255631](https://github.com/kikobeats/react-clap-button/commit/c255631)) 229 | * Remove unnecessary deps ([c48ed02](https://github.com/kikobeats/react-clap-button/commit/c48ed02)) 230 | * Setup build ([f4be01e](https://github.com/kikobeats/react-clap-button/commit/f4be01e)) 231 | * So-rry ([fc33fba](https://github.com/kikobeats/react-clap-button/commit/fc33fba)) 232 | * Update ([a454f12](https://github.com/kikobeats/react-clap-button/commit/a454f12)) 233 | * Update README.md ([180fc13](https://github.com/kikobeats/react-clap-button/commit/180fc13)) 234 | * Update README.md ([3142bc9](https://github.com/kikobeats/react-clap-button/commit/3142bc9)) 235 | * Update README.md ([feca2d3](https://github.com/kikobeats/react-clap-button/commit/feca2d3)) 236 | * Update README.md ([8e9d06b](https://github.com/kikobeats/react-clap-button/commit/8e9d06b)) 237 | * Update README.md ([2c8ba2e](https://github.com/kikobeats/react-clap-button/commit/2c8ba2e)) 238 | * Update README.md ([cb15e90](https://github.com/kikobeats/react-clap-button/commit/cb15e90)) 239 | * Update README.md ([ba12336](https://github.com/kikobeats/react-clap-button/commit/ba12336)) 240 | * Update scripts ([4aefe23](https://github.com/kikobeats/react-clap-button/commit/4aefe23)) 241 | * docs(readme): add Greenkeeper badge ([3c18b9b](https://github.com/kikobeats/react-clap-button/commit/3c18b9b)) 242 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
4 | See demo 5 | 6 | 7 |
8 | 9 |  10 | [](https://travis-ci.org/Kikobeats/react-clap-button) 11 | [](https://david-dm.org/Kikobeats/react-clap-button) 12 | [](https://david-dm.org/Kikobeats/react-clap-button#info=devDependencies) 13 | [](https://www.npmjs.org/package/react-clap-button) 14 | [](https://paypal.me/Kikobeats) 15 | 16 | > A Medium like clap button. Based on [Ohans Emmanuel](https://codepen.io/ohansemmanuel/full/zEJpYy/) CodePen, icon by [Luis Durazo](https://thenounproject.com/luisdurazo/). 17 | 18 | ## Install 19 | 20 | ```bash 21 | $ npm install react-clap-button --save 22 | ``` 23 | 24 | ## Usage 25 | 26 | ``` 27 | import React from 'react'; 28 | import ClapButton from 'react-clap-button'; 29 | 30 | export default () => { 31 | 32 | const onCountChange = ({ count, countTotal }) => { 33 | 34 | }; 35 | // All Props are Optional 36 | return ( 37 |