-
Notifications
You must be signed in to change notification settings - Fork 65
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
Showing
6 changed files
with
83 additions
and
1 deletion.
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
27 changes: 27 additions & 0 deletions
27
src/examples/src/widgets/progress/ProgressWithChangingValues.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,27 @@ | ||
import { create, tsx } from '@dojo/framework/core/vdom'; | ||
import { icache } from '@dojo/framework/core/middleware/icache'; | ||
import Progress from '@dojo/widgets/progress'; | ||
import Button from '@dojo/widgets/button'; | ||
|
||
const factory = create({ icache }); | ||
|
||
export default factory(function ProgressWithChangingvalues({ middleware: { icache } }) { | ||
const max = 100; | ||
const step = 10; | ||
const value = icache.getOrSet<number>('value', 0); | ||
return ( | ||
<div> | ||
<Progress value={value} max={max} /> | ||
<div> | ||
<Button onClick={() => icache.set('value', value - step < 0 ? 0 : value - step)}> | ||
Decrease | ||
</Button> | ||
<Button | ||
onClick={() => icache.set('value', value + step > max ? max : value + step)} | ||
> | ||
Increase | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}); |
17 changes: 17 additions & 0 deletions
17
src/examples/src/widgets/progress/ProgressWithCustomOutput.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,17 @@ | ||
import { create, tsx } from '@dojo/framework/core/vdom'; | ||
import Progress from '@dojo/widgets/progress'; | ||
|
||
const factory = create(); | ||
|
||
export default factory(function ProgressWithCustomOutput() { | ||
const value = 250; | ||
const max = 750; | ||
|
||
return ( | ||
<Progress | ||
value={value} | ||
max={max} | ||
output={(value, percent) => `${value} of ${max} is ${percent}%`} | ||
/> | ||
); | ||
}); |
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 { create, tsx } from '@dojo/framework/core/vdom'; | ||
import Progress from '@dojo/widgets/progress'; | ||
|
||
const factory = create(); | ||
|
||
export default factory(function ProgressWithMax() { | ||
return <Progress value={0.3} max={1} />; | ||
}); |
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 { create, tsx } from '@dojo/framework/core/vdom'; | ||
import Progress from '@dojo/widgets/progress'; | ||
|
||
const factory = create(); | ||
|
||
export default factory(function ProgressWithoutOutput() { | ||
return <Progress value={50} showOutput={false} />; | ||
}); |