0.1.4 • Published 4 years ago

progress-halo v0.1.4

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

progress-halo

:dizzy: React component, for adding dynamic progress ring around other components, for example around user avatar.

Examples

https://galpsi.netlify.app/posts/progress-halo

Install

If you're using npm:

npm install progress-halo --save

If you're using yarn:

yarn add progress-halo

Usage

In react component:

import React from 'react';
import ProgressHalo from 'progress-halo';

function ProgressAvatar(props) {
  const { progress, color, progressColor, radius = 60, width } = props;
  return (
    <Wrapper>
      {/*your custom avatar component or any other component*/}
      <CustomAvatar src={avatar_img} />
      <ProgressHalo
        progress={progress}
        color={color}
        progressColor={progressColor}
        radius={radius}
        width={width}
      />
    </Wrapper>
  );
}

export default ProgressAvatar;

Positioning with styled-components (preferred):

import styled from 'styled-components';
import ProgressHalo from 'progress-halo';

const Wrapper = styled.div`
  position: relative;
`;

const CustomAvatar = styled.img`
  max-width: 100px;
`;

const StyledProgressHalo = styled(ProgressHalo)`
  position: absolute;
  top: -10px;
  left: -10px;
`;

Positioning with css:

.progress-avatar__wrapper {
  position: relative;
}

.progress-avatar__image {
  max-width: 100px;
}

.progress-avatar__halo {
  position: absolute !important;  /*need this to overwrite default inline style*/
  top: -10px;
  left: -10px;
}

Props

PropsDescription
progress?: numberset current progress value in percentage
color?: stringhex color code for basic fill
progressColor?: stringhex color code for progress part
radius?: numberradius of the ring
width?: numberwidth of the ring, use integer number
className?: stringcss class name for styling
  • changing of progress property has smooth animation
0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1-yar

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago