-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adds a new circular progress component for performane score * adds metric tab bar to a v2 component with performance overall metric * add performance overall score as a type of metric * use a v2 prop to show version 2 metic and core web vital components * add overall performance metric fields * add circular bar * fix issue where performance tab was showing on the logged-out version * show error component when there's an error * adds a new circular progress component for performane score * adds metric tab bar to a v2 component with performance overall metric * add performance overall score as a type of metric * use a v2 prop to show version 2 metic and core web vital components * add overall performance metric fields * add circular bar * fix issue where performance tab was showing on the logged-out version * show error component when there's an error * remove duplicate prop
- Loading branch information
Showing
14 changed files
with
354 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
.../hosting/performance/components/circular-performance-score/circular-performance-score.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { CircularProgressBar } from '@automattic/components'; | ||
import './style.scss'; | ||
|
||
type CircularPerformanceScoreProps = { | ||
score: number; | ||
size: number; | ||
steps?: number; | ||
}; | ||
|
||
export const CircularPerformanceScore = ( { | ||
score, | ||
size, | ||
steps = 100, | ||
}: CircularPerformanceScoreProps ) => { | ||
const getStatus = ( value: number ) => { | ||
if ( value <= 49 ) { | ||
return 'poor'; | ||
} else if ( value > 49 && value < 90 ) { | ||
return 'needs-improvement'; | ||
} | ||
return 'good'; | ||
}; | ||
|
||
return ( | ||
<div className={ `circular-performance-bar ${ getStatus( score ) }` }> | ||
<CircularProgressBar | ||
currentStep={ score } | ||
size={ size } | ||
numberOfSteps={ steps } | ||
showProgressText={ false } | ||
/> | ||
<div className="circular-performance-score">{ score }</div> | ||
</div> | ||
); | ||
}; |
38 changes: 38 additions & 0 deletions
38
client/hosting/performance/components/circular-performance-score/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@import "@automattic/components/src/styles/typography"; | ||
|
||
.circular-performance-bar { | ||
position: relative; | ||
display: inline-block; | ||
|
||
&.good { | ||
color: #00ba37; | ||
.circular__progress-bar .circular__progress-bar-fill-circle { | ||
stroke: #00ba37; | ||
} | ||
} | ||
|
||
&.needs-improvement { | ||
color: #d67709; | ||
.circular__progress-bar .circular__progress-bar-fill-circle { | ||
stroke: #d67709; | ||
} | ||
} | ||
|
||
&.poor { | ||
color: #d63638; | ||
.circular__progress-bar .circular__progress-bar-fill-circle { | ||
stroke: #d63638; | ||
} | ||
} | ||
} | ||
|
||
.circular-performance-score { | ||
position: absolute; | ||
transform: translate(-50%, -50%); | ||
top: 50%; | ||
left: 50%; | ||
font-family: $font-sf-pro-display; | ||
font-size: $font-size-header-small; | ||
font-weight: 400; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.