Skip to content

Commit

Permalink
docs(ui-progress): add renderValue and formatScreenreaderValue to eac…
Browse files Browse the repository at this point in the history
…h example in ProgressBar

Closes: INSTUI-4283
  • Loading branch information
ToMESSKa committed Dec 9, 2024
1 parent 56308de commit f1b4172
Showing 1 changed file with 122 additions and 0 deletions.
122 changes: 122 additions & 0 deletions packages/ui-progress/src/ProgressBar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,65 @@ type: example
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
size="small"
screenReaderLabel="Loading completion"
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
screenReaderLabel="Loading completion"
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
size="large"
screenReaderLabel="Loading completion"
valueNow={40}
valueMax={60}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
</div>
```
Expand All @@ -56,6 +96,16 @@ type: example
color="primary-inverse"
valueNow={30}
valueMax={60}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
</View>
```
Expand All @@ -75,34 +125,84 @@ type: example
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
screenReaderLabel="Loading completion"
meterColor="success"
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
screenReaderLabel="Loading completion"
meterColor="alert"
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
screenReaderLabel="Loading completion"
meterColor="warning"
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
<ProgressBar
screenReaderLabel="Loading completion"
meterColor="danger"
valueNow={40}
valueMax={60}
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
</div>
```
Expand All @@ -128,6 +228,16 @@ type: example
}}
valueNow={10}
valueMax={60}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
{Math.round(valueNow / valueMax * 100)}%
</Text>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax * 100)) + ' percent'
}}
/>
```

Expand Down Expand Up @@ -259,6 +369,12 @@ The `shouldAnimate` prop makes the progress bar animate the transition between v
valueNow={this.state.value}
valueMax={this.MAX}
shouldAnimate={this.state.shouldAnimate}
renderValue={({ valueNow, valueMax }) => {
return <Text>{Math.round((valueNow / valueMax) * 100)}%</Text>
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax) * 100) + ' percent'
}}
/>
</div>
)
Expand Down Expand Up @@ -346,6 +462,12 @@ The `shouldAnimate` prop makes the progress bar animate the transition between v
valueNow={value}
valueMax={MAX}
shouldAnimate={shouldAnimate}
renderValue={({ valueNow, valueMax }) => {
return <Text>{Math.round((valueNow / valueMax) * 100)}%</Text>
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax) * 100) + ' percent'
}}
/>
</div>
)
Expand Down

0 comments on commit f1b4172

Please sign in to comment.