-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/style fixes #916
Fix/style fixes #916
Changes from 2 commits
9a1acef
34fcc85
024462b
23dad1b
b67f066
7bc4dfe
64d4ff8
252b1d2
1c5b2df
5ef2790
6da8266
4963f21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{% shortCode name="where-is-this-available" /%} | ||
|
||
{% availabilityContent | ||
availableGel="available" | ||
availableMesh="in-progress" | ||
availableLegacyWdp="older-version-available" /%} | ||
availableGel="available" | ||
availableMesh="in-progress" | ||
availableLegacyWdp="older-version-available" /%} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,74 @@ | ||
import React from 'react'; | ||
|
||
import { Icon } from '../icon/icon.component.js'; | ||
import { Label } from '../label/label.component.js'; | ||
|
||
import { styles } from './progress-indicator.styles.js'; | ||
import { styles as ProgressIndicatorStyles } from './progress-indicator.styles.js'; | ||
import { ProgressIndicatorProps } from './progress-indicator.types.js'; | ||
|
||
export function ProgressIndicator({ | ||
className, | ||
children, | ||
color = 'hero', | ||
inverted = false, | ||
HZ991 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
label, | ||
size = 'medium', | ||
embedIcon: EmbedIcon, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this to just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is icon: EmbedIcon ok, it is just conflicting with the other 'Icon' import |
||
className, | ||
'aria-label': ariaLabel = 'Loading', | ||
...props | ||
}: ProgressIndicatorProps) { | ||
const styles = ProgressIndicatorStyles({ | ||
size, | ||
inverted, | ||
}); | ||
|
||
const sizeMap: Record<string, { strokeWidth: number }> = { | ||
xlarge: { strokeWidth: 4 }, | ||
large: { strokeWidth: 4 }, | ||
medium: { strokeWidth: 15 }, | ||
small: { strokeWidth: 20 }, | ||
xsmall: { strokeWidth: 30 }, | ||
}; | ||
|
||
const strokeHalfWidth = sizeMap[size.toString()].strokeWidth / 2; | ||
const setPath = ( | ||
<g strokeWidth={strokeHalfWidth * 2}> | ||
<> | ||
<path | ||
stroke="url(#a)" | ||
d={`M ${strokeHalfWidth} 90 A ${90 - strokeHalfWidth} ${90 - strokeHalfWidth} 0 0 1 ${180 - strokeHalfWidth} 90`} | ||
></path> | ||
<path | ||
stroke="url(#b)" | ||
d={`M ${180 - strokeHalfWidth} 90 A ${90 - strokeHalfWidth} ${90 - strokeHalfWidth} 0 0 1 ${strokeHalfWidth} 90`} | ||
></path> | ||
</> | ||
</g> | ||
); | ||
|
||
return ( | ||
<Icon className={styles({ className })} size={size} color={color} aria-label={ariaLabel} {...props}> | ||
{children} | ||
</Icon> | ||
<div aria-label={ariaLabel} className={styles.container()}> | ||
<div className="relative"> | ||
<Icon | ||
viewBox="0 0 180 180" | ||
fill="none" | ||
color={inverted ? 'white' : 'hero'} | ||
HZ991 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
className={styles.base({ className })} | ||
{...props} | ||
> | ||
<defs> | ||
<linearGradient id="a"> | ||
<stop offset="0%" stopOpacity="0" stopColor="currentColor"></stop> | ||
<stop offset="100%" stopColor="currentColor"></stop> | ||
</linearGradient> | ||
<linearGradient id="b"> | ||
<stop offset="0%" stopColor="currentColor"></stop> | ||
<stop offset="50%" stopColor="currentColor"></stop> | ||
</linearGradient> | ||
</defs> | ||
{setPath} | ||
</Icon> | ||
{EmbedIcon && size === 'large' && <EmbedIcon size="large" className={styles.icon()} />} | ||
HZ991 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
{label && size === 'large' && <Label className={styles.label()}>{label}</Label>} | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { IconProps } from '../icon/icon.types.js'; | ||
|
||
export type ProgressIndicatorProps = IconProps; | ||
export type ProgressIndicatorProps = IconProps & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: Update to |
||
/** | ||
* children prop | ||
* @default false | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Icon embedded in progress indicator | ||
*/ | ||
embedIcon?: (props: IconProps) => JSX.Element; | ||
/** | ||
* Progress indicator color | ||
* @default false | ||
*/ | ||
inverted?: boolean; | ||
HZ991 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/** | ||
* Label placed below progress indicator | ||
*/ | ||
label?: string; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed revert back to color prop to be aligned with icon props