-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #916 from WestpacGEL/fix/style-fixes
Fix/style fixes
- Loading branch information
Showing
15 changed files
with
179 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@westpac/ui': minor | ||
--- | ||
|
||
Updated the appearance and svg of progress indicator component; updated visual bugs in header and badge; |
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
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
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
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
60 changes: 53 additions & 7 deletions
60
packages/ui/src/components/progress-indicator/progress-indicator.component.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 |
---|---|---|
@@ -1,21 +1,67 @@ | ||
import React from 'react'; | ||
import React, { useId } 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', | ||
label, | ||
size = 'medium', | ||
icon: EmbedIcon, | ||
className, | ||
'aria-label': ariaLabel = 'Loading', | ||
...props | ||
}: ProgressIndicatorProps) { | ||
const styles = ProgressIndicatorStyles({ | ||
size, | ||
color, | ||
}); | ||
|
||
const id = useId(); | ||
|
||
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; | ||
|
||
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={color} className={styles.base({ className })} {...props}> | ||
<defs> | ||
<linearGradient id={`${id}-1`}> | ||
<stop offset="0%" stopOpacity="0" stopColor="currentColor" /> | ||
<stop offset="100%" stopColor="currentColor" /> | ||
</linearGradient> | ||
<linearGradient id={`${id}-2`}> | ||
<stop offset="0%" stopColor="currentColor" /> | ||
<stop offset="50%" stopColor="currentColor" /> | ||
</linearGradient> | ||
</defs> | ||
<g strokeWidth={strokeHalfWidth * 2}> | ||
<> | ||
<path | ||
stroke={`url(#${id}-1)`} | ||
d={`M ${strokeHalfWidth} 90 A ${90 - strokeHalfWidth} ${90 - strokeHalfWidth} 0 0 1 ${180 - strokeHalfWidth} 90`} | ||
></path> | ||
<path | ||
stroke={`url(#${id}-2)`} | ||
d={`M ${180 - strokeHalfWidth} 90 A ${90 - strokeHalfWidth} ${90 - strokeHalfWidth} 0 0 1 ${strokeHalfWidth} 90`} | ||
></path> | ||
</> | ||
</g> | ||
</Icon> | ||
{EmbedIcon && size === 'large' && <EmbedIcon size="large" color={color} className={styles.icon()} />} | ||
</div> | ||
{label && size === 'large' && <Label className={styles.label()}>{label}</Label>} | ||
</div> | ||
); | ||
} |
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
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
18 changes: 17 additions & 1 deletion
18
packages/ui/src/components/progress-indicator/progress-indicator.types.ts
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { IconProps } from '../icon/icon.types.js'; | ||
|
||
export type ProgressIndicatorProps = IconProps; | ||
export type ProgressIndicatorProps = Omit<IconProps, 'copyrightYear' | 'look'> & { | ||
/** | ||
* children prop | ||
* @default false | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Icon embedded in progress indicator | ||
*/ | ||
icon?: (props: IconProps) => JSX.Element; | ||
/** | ||
* Label placed below progress indicator | ||
*/ | ||
label?: string; | ||
}; |
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