1.0.11 • Published 3 years ago

smart-background v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Smart Background

npm version npm version npm version npm version npm version npm version

An React Component Can Automatically Generate The Background

一个快速生成元素背景的react组件

repository-open-graph-template副本

Live demo

https://yuanguandong.github.io/smart-background/

Install

npm i smart-background -S

How to use

import React from 'react';
import Background from 'smart-background';
import { FaLaugh } from 'react-icons/fa';

export default () => {
  return (
    <div style={styles.container}>
      <Background underlayColor="#f00" animation={{ type: 'bottom', speed: 5 }}>
        <div style={styles.content}>
          <FaLaugh style={styles.icon} />
          <h1 style={styles.text}>JUST DO IT</h1>
        </div>
      </Background>
    </div>
  );
};

const styles = {
  container: { width: '100%', position: 'relative', height: 350 },
  content: {
    width: '100%',
    height: '100%',
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center',
    flexDirection: 'column',
  },
  icon: { color: '#fff', fontSize: 120 },
  text: { color: '#fff', fontSize: 36, fontWeight: 'bold' },
};

Props

propertydescriptiontypedefaultValuerequired
symbols元素/字符/符号集合(string | ReactNode | Element) '●'false
random符号是否随机生成位置和大小{ fontSizeRange: number[] } | undefinedfalse
underlayColor底衬颜色stringfalse
underlayImage底衬图片stringfalse
symbolsStyle符号样式Object{color: '#000', opacity: '0.3'}false
rotate符号旋转角度number0false
symbolSize符号大小number90false
gap符号间距number10false
animation滚动动画{type: 'left' | 'right' | 'top' | 'bottom'; speed: number;}false
exact精确模式booleanfalsefalse
childrenWrapClassName子组件容器类名stringfalse
childrenWrapStyle子组件容器类名React.CSSPropertiesfalse
1.0.11

3 years ago

1.0.9

3 years ago

1.0.10

3 years ago

1.0.8

3 years ago

1.0.2

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.1

3 years ago