Skip to content

Commit db8a48e

Browse files
committedJan 23, 2021
add emotion + bugfixes
1 parent 45197c0 commit db8a48e

File tree

8 files changed

+246
-61
lines changed

8 files changed

+246
-61
lines changed
 

‎build/index.css

-1
This file was deleted.

‎build/index.js

-19
This file was deleted.

‎example/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22

3-
import { CircleProgress } from '../src/index'
3+
import { CircleProgress } from '../src/index.js'
44

55
export default class App extends React.Component {
66
render () {

‎package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
{
22
"name": "react-gradient-progress",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Simple and light gradient-enabled circular progressbar for reactjs/nextjs",
55
"author": "Prasanna Mestha",
6-
"main": "build/index.js",
6+
"main": "src/index.js",
77
"scripts": {
88
"start": "parcel ./example/index.html",
9-
"build": "rm -rf build && parcel build src/index.js -d build --no-source-maps"
9+
"build": "rm -rf build && parcel build src/index.js -d build --no-source-maps --no-minify"
1010
},
1111
"repository": "https://github.com/prasannamestha/react-gradient-progress",
1212
"dependencies": {
13+
"@emotion/react": "^11.1.4",
14+
"@emotion/styled": "^11.0.0",
1315
"prop-types": "^15.7.2",
1416
"react": "^17.0.1",
1517
"react-dom": "^17.0.1"
@@ -32,4 +34,4 @@
3234
"percentage",
3335
"indicator"
3436
]
35-
}
37+
}

‎src/GradientCircleProgressbar.js

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3+
import styled from '@emotion/styled'
34

4-
import './circle.css'
5+
const CircleContainer = styled.div`
6+
display: inline-block;
7+
border-radius: 100%;
8+
position: relative;`
59

6-
const CircleContainer = ({ children, style }) => <div className="react-super-progressbar__base" style={style}>{children}</div>
10+
const PercentageContainer = styled.div`
11+
position: absolute;
12+
height: 100%;
13+
width: 100%;
14+
top: 0;
15+
left: 0;
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
flex-direction: column;
20+
text-align: center,`
721

8-
const PercentageContainer = ({ children }) => <div className="react-super-progressbar__percentage-container">{children}</div>
9-
10-
const StyledCircle = ({ children, ...props }) => <circle className="react-super-progressbar__styled-circle" {...props}>{children}</circle>
22+
const StyledCircle = styled.circle`
23+
transform: rotate(-90deg);
24+
transform-origin: 50% 50%;`
25+
// const CircleContainer = ({ children, style }) => <div className="react-super-progressbar__base" style={style}>{children}</div>
26+
// const PercentageContainer = ({ children }) => <div className="react-super-progressbar__percentage-container">{children}</div>
27+
// const StyledCircle = ({ children, ...props }) => <circle className="react-super-progressbar__styled-circle" {...props}>{children}</circle>
1128

1229
const GradientCircleProgressbar = ({
1330
percentage,
@@ -31,13 +48,14 @@ const GradientCircleProgressbar = ({
3148

3249
return (
3350
<CircleContainer
51+
className="react-super-progressbar__base"
3452
style={{
3553
height: `${width}px`,
3654
width: `${width}px`,
3755
}}
3856
>
3957
{!hidePercentageText ?
40-
<PercentageContainer>
58+
<PercentageContainer className="react-super-progressbar__percentage-container">
4159
<span
4260
className="react-super-progressbars__percentage"
4361
style={{

‎src/circle.css

-23
This file was deleted.

‎src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default as CircleProgress } from './GradientCircleProgressbar'
1+
export { default as CircleProgress } from './GradientCircleProgressbar.js'

0 commit comments

Comments
 (0)