Giter Site home page Giter Site logo

hirohe / react-watermark Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 3.0 465 KB

A React Component to wrap watermark text on child component, using generated svg as background-image

Home Page: https://hirohe.github.io/react-watermark/?path=/docs/watermark-test--default

License: MIT License

JavaScript 15.13% TypeScript 84.87%
react reactcompoenets component watermark

react-watermark's Introduction

React Watermark Component

version

A React Component to wrap watermark text on child component, using generated svg as background-image

Doc

Storybook

Usage:

this Component requires react version >=16.8.0, in order to use the react hook feature

yarn add @hirohe/react-watermark
# or
npm i --save @hirohe/react-watermark

e.g.

import { Watermark } from '@hirohe/react-watermark';

const ContentWithWatermark = () => (
  <Watermark text="Mark">
    <div style={{ width: 500, height: 500, backgroundColor: '#5f5f5f' }}>
      Lorem ipsum
    </div>
  </Watermark>
)

example

Props

prop description type default
show show watermark or not boolean true
text watermark text string -
textColor color of watermark color string #cccccc
textSize watermark text size in px unit number 24
fontFamily watermark text font-family string Arial, Helvetica, sans-serif
lineHeight watermark text lineHeight string '1.2rem'
multiline whether text is multiline or not boolean false
opacity watermark text opacity number 0.2
rotate watermark text rotate degree number -45
gutter gutter between watermark text number 0
wrapperStyle style of wrapper CSSProperties -
wrapperElement element of wrapper React.ElementType 'div'

TODO

  • multiline watermark text
  • adjustable space between watermark

License

MIT License. See LICENSE.txt for more information.

react-watermark's People

Contributors

hirohe avatar novell-star avatar zhihaolau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-watermark's Issues

Watermark throws Hydration Error on NextJs

Details of error:

Unhandled Runtime Error
Error: Hydration failed because the initial UI does not match what was rendered on the server.

See more info here: https://nextjs.org/docs/messages/react-hydration-error

next-dev.js?3515:20 Warning: Prop style did not match. Server: "pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0;background-repeat:repeat;z-index:1" Client: "pointer-events:none;position:absolute;top:0;bottom:0;left:0;right:0;content:;background-repeat:repeat;z-index:1;background-image:"
at div
at div
at Watermark (webpack-internal:///./node_modules/@hirohe/react-watermark/build/index.esm.js:68:17)

Wondering if you have any guidance here? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.