-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00c2129
commit e2877ad
Showing
7 changed files
with
81 additions
and
3 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
40 changes: 40 additions & 0 deletions
40
src/components/rating-linear-progress/rating-linear-progress.jsx
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,40 @@ | ||
// | ||
// Copyright (c) DITUS INC. All rights reserved. See LICENSE file in the project | ||
// root for details. | ||
// | ||
import React from 'react'; | ||
import { | ||
LinearProgress, | ||
} from '@mui/material'; | ||
import { styled } from '@mui/material/styles'; | ||
|
||
const StyledLinearProgress = styled(LinearProgress)(({ theme }) => ({ | ||
'&.MuiLinearProgress-root': { | ||
height: 20, | ||
borderRadius: 5, | ||
borderWidth: 1, | ||
borderColor: theme.palette.grey[200], | ||
borderStyle: 'solid', | ||
}, | ||
'&.MuiLinearProgress-colorPrimary': { | ||
backgroundColor: theme.palette.grey[100], | ||
}, | ||
})); | ||
|
||
/** | ||
* Represents a linear progress bar that displays the rating of a product. | ||
* @param {*} props The properties of the component. | ||
* @returns {HTMLElement} An HTML element representing the component. | ||
*/ | ||
function RatingLinearProgress(props) { | ||
return ( | ||
<StyledLinearProgress | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
variant="determinate" | ||
color="primary" | ||
/> | ||
); | ||
} | ||
|
||
export default RatingLinearProgress; |
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,30 @@ | ||
/* eslint-disable jsdoc/require-jsdoc */ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import React from 'react'; | ||
import { createTheme, ThemeProvider } from '@mui/material/styles'; | ||
import { CssBaseline } from '@mui/material'; | ||
import RatingLinearProgress from '../components/rating-linear-progress/rating-linear-progress'; | ||
|
||
export default { | ||
title: 'Components/RatingLinearProgress', | ||
component: RatingLinearProgress, | ||
argTypes: { | ||
}, | ||
}; | ||
|
||
const theme = createTheme({ | ||
}); | ||
|
||
function Template(args) { | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
<RatingLinearProgress {...args} /> | ||
</ThemeProvider> | ||
); | ||
} | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
value: 50, | ||
}; |