ColinEberhardt / applause-button

A zero-configuration medium-style button for adding applause / claps / kudos to web pages and blog posts
http://applause-button.com/
MIT License
426 stars 41 forks source link

How to use it in NextJs (Override css) #80

Closed zhex900 closed 3 years ago

zhex900 commented 3 years ago

Hi,

I am trying to use this component in nextjs. This is my wrapper component. But the clap count is in the wrong place.

Screen Shot 2021-08-03 at 9 34 51 am

I need to adjust the css

Screen Shot 2021-08-03 at 9 36 22 am Screen Shot 2021-08-03 at 9 36 47 am

How do I override the css?

import { useEffect } from 'react'
import 'applause-button/dist/applause-button.css'

export default function ApplauseButton() {
  useEffect(() => import('applause-button'), [])

  const size = 25

  return (
    <div>
      <applause-button style={{ width: size, height: size }} multiclap={true} />
    </div>
  )
}
zhex900 commented 3 years ago

I solved it myself.

import { useEffect } from 'react'
import 'applause-button/dist/applause-button.css'
import './ApplauseButton.module.css'
export default function ApplauseButton() {
  useEffect(() => {
    import('applause-button')
  }, [])

  const size = 25

  return (
    <div>
      <applause-button
        id="applause-button"
        color="#2dd4bf"
        style={{ width: size, height: size }}
        multiclap={true}
      />
    </div>
  )
}

I have add this css

#applause-button .count-container { top: -90%; } to the main style .