-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ProgressIndicator component MAASENG-2571 (#103)
- Loading branch information
Showing
6 changed files
with
55 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@import "vanilla-framework"; | ||
@include vf-base; | ||
|
||
.progress-indicator { | ||
margin: 0; | ||
padding: 0 $spv--small 0 0; | ||
|
||
.progress-indicator__spinner { | ||
padding-left: $spv--x-small; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/lib/elements/ProgressIndicator/ProgressIndicator.test.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,8 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
import { ProgressIndicator } from "./ProgressIndicator"; | ||
|
||
it("renders without crashing", () => { | ||
render(<ProgressIndicator percentComplete={69} />); | ||
expect(screen.getByText("69%")).toBeInTheDocument(); | ||
}); |
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,16 @@ | ||
import { Spinner } from "@canonical/react-components"; | ||
import "./ProgressIndicator.scss"; | ||
|
||
export interface ProgressIndicatorProps { | ||
percentComplete: number; | ||
} | ||
|
||
export const ProgressIndicator: React.FC<ProgressIndicatorProps> = ({ | ||
percentComplete, | ||
}: ProgressIndicatorProps) => { | ||
return ( | ||
<small className="progress-indicator"> | ||
{percentComplete}% <Spinner className="progress-indicator__spinner" /> | ||
</small> | ||
); | ||
}; |
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 @@ | ||
export * from "./ProgressIndicator"; |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from "./Meter"; | ||
export * from "./ExternalLink"; | ||
|
||
export * from "./ProgressIndicator"; |