Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions packages/ui-progress/src/ProgressBar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -37,9 +37,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -53,9 +53,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -69,9 +69,9 @@ type: example
valueMax={60}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -98,9 +98,9 @@ type: example
valueMax={60}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -127,9 +127,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -144,9 +144,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -161,9 +161,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -178,9 +178,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand All @@ -195,9 +195,9 @@ type: example
margin="0 0 small"
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand Down Expand Up @@ -230,9 +230,9 @@ type: example
valueMax={60}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
Expand Down Expand Up @@ -263,9 +263,9 @@ type: example
}}
renderValue={({ valueNow, valueMax }) => {
return (
<Text>
<span>
{Math.round(valueNow / valueMax * 100)}%
</Text>
</span>
)
}}
valueMax={88}
Expand Down Expand Up @@ -359,7 +359,7 @@ const Example = () => {
valueMax={MAX}
shouldAnimate={shouldAnimate}
renderValue={({ valueNow, valueMax }) => {
return <Text>{Math.round((valueNow / valueMax) * 100)}%</Text>
return <span>{Math.round((valueNow / valueMax) * 100)}%</span>
}}
formatScreenReaderValue={({ valueNow, valueMax }) => {
return Math.round((valueNow / valueMax) * 100) + ' percent'
Expand Down
5 changes: 2 additions & 3 deletions packages/ui-progress/src/ProgressBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ import { Component } from 'react'
import { View } from '@instructure/ui-view'
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils'

import { withStyleRework as withStyle } from '@instructure/emotion'
import { withStyle } from '@instructure/emotion'

import generateStyle from './styles'
import generateComponentTheme from './theme'

import type { ProgressBarProps, Values } from './props'
import { allowedProps } from './props'
Expand All @@ -40,7 +39,7 @@ import { allowedProps } from './props'
category: components
---
**/
@withStyle(generateStyle, generateComponentTheme)
@withStyle(generateStyle)
class ProgressBar extends Component<ProgressBarProps> {
static readonly componentId = 'ProgressBar'

Expand Down
28 changes: 22 additions & 6 deletions packages/ui-progress/src/ProgressBar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* SOFTWARE.
*/

import type { ProgressBarTheme } from '@instructure/shared-types'
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
import type { ProgressBarProps, ProgressBarStyle } from './props'

/**
Expand All @@ -32,12 +32,13 @@ import type { ProgressBarProps, ProgressBarStyle } from './props'
* Generates the style object from the theme and provided additional information
* @param {Object} componentTheme The theme variable object.
* @param {Object} props the props of the component, the style is applied to
* @param {Object} state the state of the component, the style is applied to
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
* @return {Object} The final style object, which will be used in the component
*/
const generateStyle = (
componentTheme: ProgressBarTheme,
props: ProgressBarProps
componentTheme: NewComponentTypes['ProgressBar'],
props: ProgressBarProps,
_sharedTokens: SharedTokens
): ProgressBarStyle => {
const {
valueNow = 0,
Expand Down Expand Up @@ -82,12 +83,24 @@ const generateStyle = (
trackLayout: { background: componentTheme.trackColor },
trackBorder: {
borderBottomColor: componentTheme.trackBottomBorderColor
},
value: {
color: componentTheme.textColor
},
htmlProgress: {
borderColor: componentTheme.borderColor
}
},
'primary-inverse': {
trackLayout: { background: componentTheme.trackColorInverse },
trackBorder: {
borderBottomColor: componentTheme.trackBottomBorderColorInverse
},
value: {
color: componentTheme.textColorInverse
},
htmlProgress: {
borderColor: componentTheme.borderColorInverse
}
}
}
Expand Down Expand Up @@ -167,7 +180,8 @@ const generateStyle = (
paddingInlineStart: componentTheme.valuePadding,
flex: '0 0 5.625rem',

...sizeVariants[size!].value
...sizeVariants[size!].value,
...colorVariants[color!].value
},

htmlProgress: {
Expand All @@ -180,7 +194,9 @@ const generateStyle = (
height: '100%',
boxSizing: 'border-box',
zIndex: -1,
opacity: 0
opacity: 0,

...colorVariants[color!].htmlProgress
}
}
}
Expand Down
107 changes: 0 additions & 107 deletions packages/ui-progress/src/ProgressBar/theme.ts

This file was deleted.

Loading