-
Notifications
You must be signed in to change notification settings - Fork 1
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
Storybook audit #1337
base: develop
Are you sure you want to change the base?
Storybook audit #1337
Conversation
|
081970f
to
f5ba758
Compare
b0c1c57
to
314b261
Compare
f3940d2
to
9a559ef
Compare
interface GoBreadcrumbsProps { | ||
routeData: RouteData[] | ||
} |
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.
interface GoBreadcrumbsProps { | |
routeData: RouteData[] | |
} | |
interface GoBreadcrumbsProps { | |
routeData: RouteData[]; | |
} |
keySelector={(datum) => datum.to} | ||
labelSelector={(datum) => datum.label} |
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.
Let's define function and use them instead.
const rendererParams = () => ({}); | ||
|
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.
Why do we need this?
labelSelector, | ||
rendererParams, | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
renderer: (props) => <div {...props} />, |
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.
This doesn't look right
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.
I am not sure if changing how we use Breadcrums is a good change.
cc: @frozenhelium @samshara
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.
@tnagorra Can you propose a better alternative. The requirement is that we need to separately style the leaf link.
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.
Looks like the leaf link is already styled differently in current approach as well.
We can use this new approach if we want more flexibility.
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.
Was this change required on the storybook audit?
.table-link{ | ||
color: var(--go-ui-color-text); | ||
} | ||
.table-link:hover { | ||
color: var(--go-ui-color-primary-red); | ||
} | ||
.table-header-row { | ||
background:var(--go-ui-color-primary-gray-10); | ||
} |
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.
These styles should not be added here
@@ -1,7 +1,7 @@ | |||
.alert { | |||
display: flex; | |||
border-radius: var(--go-ui-border-radius-md); | |||
box-shadow: var(--go-ui-box-shadow-2xl); | |||
box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.2); |
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.
We should create design tokens for these.
cc: @frozenhelium
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.
I am not sure how the following feature are implemented in this file:
- Remove the header on Alert popup
- Add a "x" button to close the alert
Reference: #1291
@@ -20,13 +20,13 @@ | |||
} | |||
|
|||
.bar-track { | |||
border-radius: 0.3rem; | |||
border-radius: 0 var(--go-ui-border-radius-md) var(--go-ui-border-radius-md) 0; |
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.
Is --go-ui-border-radius-md
equal or close to 0.3rem
?
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.
No, it's not, but the requirement was to remove border from the left side of the bar
font-size: var(--go-ui-height-icon-multiplier); | ||
} | ||
|
||
.content { | ||
flex-direction: column; | ||
gap: 0; | ||
line-height: var(--go-ui-line-height-sm); | ||
color: var(--go-ui-color-black); |
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.
We should not hard-code this change here. The suggestion most probably applies to the whole site.
cc: @frozenhelium
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.
The change is for the whole site
text-transform: var(--text-transform); | ||
line-height: var(--go-ui-line-height-xs); | ||
line-height: 21px; |
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.
Not sure this is the correct way. Also, let's use design tokens.
cc: @frozenhelium
export const ProcessButtonWithIcon: Story = { | ||
args: { | ||
name: 'button', | ||
variant: 'secondary', | ||
children: 'Process Button', | ||
// icons:<LoaderLineIcon/> | ||
}, | ||
}; |
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.
The story for "process" buttion is not correct.
|
||
const buttonVariantToClassNameMap: Record<ButtonVariant, string> = { | ||
primary: styles.primary, | ||
secondary: styles.secondary, | ||
tertiary: styles.tertiary, | ||
'tertiary-on-dark': styles.tertiaryOnDark, | ||
'dropdown-item': styles.dropdownItem, | ||
process: styles.process, |
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.
Not sure if we have this style already. But, implementing "process buttion" is adding props to indicate loading and completed state in a button.
.disabled { | ||
border-color: var(--go-ui-color-gray-40); | ||
background-color: var(--go-ui-color-gray-40); | ||
color: var(--go-ui-color-black); | ||
} |
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.
This is not correct. The styling should be handled by the Button component itself.
padding-left:12px; | ||
height: 24px; |
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.
@frozenhelium Not sure if this is the way to set fixed height for inputs.
Also we should use design tokens.
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.
It was requested by the auditor
@@ -8,9 +8,10 @@ | |||
border-radius: var(--go-ui-border-radius-md); | |||
background-color: var(--go-ui-color-element-background); | |||
padding: 0 var(--go-ui-spacing-sm); | |||
|
|||
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.
@@ -1,6 +1,5 @@ | |||
.input-label { | |||
display: flex; | |||
padding: 0 var(--go-ui-spacing-2xs); |
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.
Shouldn't we be adding instead of removing the padding? Has this been defined somewhere else now?
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.
It was removed to maintain label and value spacing as mentioned by the auditor
@@ -80,10 +83,12 @@ function Header(props: Props) { | |||
{headingDescription} | |||
</div> | |||
)} | |||
{modalHeading && <div className={styles.border} />} |
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.
We don't need this change. We can just use withHeaderBorder
prop
@@ -1,4 +1,8 @@ | |||
.header { | |||
display: flex; | |||
flex-direction: column; | |||
|
|||
.border { |
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.
We don't need this change. We can just use withHeaderBorder
prop
@@ -25,6 +25,7 @@ export interface Props { | |||
level?: HeadingLevel; | |||
children: ReactNode; | |||
ellipsize?: boolean; | |||
modalHeading?: boolean; |
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.
Instead of adding modalHeading
, should use className to override the className
|
||
&.modal-font-weight { | ||
font-weight: var(--go-ui-font-weight-medium); | ||
} |
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.
Instead of adding modalHeading
, should use className to override the className
@@ -30,6 +30,7 @@ export interface Props { | |||
className?: string; | |||
contentViewType?: 'grid' | 'vertical' | 'default'; | |||
ellipsizeHeading?: boolean; | |||
modalHeading?: boolean; |
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.
We don't need this change. We can just use withHeaderBorder
prop
{icons && ( | ||
<div> | ||
{icons} | ||
</div> | ||
)} |
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.
We already have iconSrc. We don't need icons prop
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.
iconSrc is for image path, icons prop is the for the icons, types are different
&.empty-message { | ||
padding-top: 40px; | ||
height: 200px; | ||
} |
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.
This styling applied for all cases.
Use design tokens.
We need a padding of 40px between the main text and description
className, | ||
)} | ||
icon={<AnalysisIcon />} | ||
icon={(!empty || filtered || errored) && <AnalysisIcon />} |
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.
Not sure how this logic works!
@@ -93,6 +93,7 @@ function Modal(props: Props) { | |||
<Container | |||
// eslint-disable-next-line react/jsx-props-no-spreading | |||
{...containerProps} | |||
modalHeading |
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.
Looks like all headers on modal/popup should have weight 500.
We don't need modalHeading to update the weight. Also, modalHeading
in context of Container
does not make sense.
width: 100%; | ||
width: 420px; |
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.
Let's use design tokens. Also, the width should be set on the modal-container
cc: @frozenhelium ?
return ( | ||
<SelectInputContainer | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...otherProps} | ||
name={name} | ||
options={realOptions} | ||
optionsPending={optionsPending} | ||
selectedOptions={selectedOptions} |
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.
Why was this line added? Was there previously a bug?
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.
No, it was already there.
"buttonTitleClear":"Clear", | ||
"buttonClearAll":"Clear All", |
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.
Why do we need 2 labels for "Clear"
if (!persistentOptionPopup) { | ||
handleHideDropdown(); | ||
} |
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.
Why remove handling of persistentOptionPopup? This should either be removed from the props or not removed at all.
{!readOnly && onSelectAllButtonClick | ||
&& <div className={styles.clearAllBorder} />} |
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.
The formatting is not clear
@@ -355,9 +335,60 @@ function SelectInputContainer< | |||
parentRef={inputSectionRef} | |||
className={_cs(optionsPopupClassName, styles.popup)} | |||
> | |||
<div className={styles.clearButtonContainer}> |
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.
This is not just clearButtionContainer
const availableOptions = options.filter( | ||
(option) => !selectedOptions?.some( | ||
(selectedOption) => optionKeySelector( | ||
selectedOption, | ||
0, | ||
) === optionKeySelector(option, 0), | ||
), | ||
); |
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.
Let's use a dict to filter these options. Also, add note what available options are.
Also, is this change correct for single select inputs?
.clear-all-border { | ||
border: var(--go-ui-width-separator-thin) solid var(--go-ui-color-separator); | ||
} |
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.
This is not a border. It's a separator.
const handleSelectAll = useCallback( | ||
() => { | ||
if (isNotDefined(options)) { | ||
return; | ||
} | ||
|
||
const allValues = options.map(keySelector); | ||
onChange(allValues, name); | ||
}, | ||
[options, name, onChange, keySelector], | ||
); |
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.
Select All cannot be added to search multi select inputs.
|
||
.legend-item { | ||
text-transform: uppercase; |
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.
It's not mentioned as a changed but the example image has uppercase words.
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.
No, Change for text style has been mentioned
border-bottom: var(--go-ui-width-separator-thin) solid var(--go-ui-color-separator); | ||
padding: 0 0 2px 0; |
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.
Why was this changed? Also use design tokens
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.
It was changed for the new secondary variant design.
@@ -3,7 +3,7 @@ | |||
|
|||
.segment-list { | |||
flex-wrap: nowrap; | |||
border: var(--go-ui-width-separator-thin) solid var(--go-ui-color-separator); | |||
border:#F7F7F7 solid var(--go-ui-color-separator); |
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.
Use design tokens. Also, we don't need a border at all.
@@ -13,7 +13,7 @@ | |||
|
|||
.segment { | |||
border-radius: var(--go-ui-border-radius-full); | |||
padding: var(--go-ui-spacing-3xs) var(--go-ui-spacing-md); | |||
padding: var(--go-ui-spacing-3xs) var(--go-ui-spacing-md); |
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.
padding: var(--go-ui-spacing-3xs) var(--go-ui-spacing-md); | |
padding: var(--go-ui-spacing-3xs) var(--go-ui-spacing-md); |
padding: var(--go-ui-spacing-sm); | ||
padding: 12px; |
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.
Let's use design tokens.
Also not sure if "top and bottom lines Indents must be at least 12 px." means adding padding
@@ -302,5 +310,6 @@ export const WithResizableColumn: Story = { | |||
keySelector, | |||
caption: 'You can utilize the header column to adjust the width of each column.', | |||
resizableColumn: true, | |||
headerRowClassName: 'table-header-row', |
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.
This is not correct. The header row color should be updated in the Table component itself.
@@ -188,6 +188,7 @@ function NavigationTab(props: Props) { | |||
)} | |||
<div className={styles.childrenWrapper}> | |||
{children} | |||
<div className={styles.activeChildrenBorder} /> |
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.
- Not sure if this is the right approach.
- This should only be added on certain variants.
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.
It's only for primary variant. Styles condition are in corresponding styles file
position: absolute; | ||
left: 45%; |
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.
Not sure if this works @frozenhelium
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.
Looks like it works!
&.secondary { | ||
display: flex; | ||
overflow-x: auto; | ||
|
||
.content { |
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.
Is this not used?
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.
yes, this is not used
import Container from '#components/Container'; | ||
import DropdownMenu from '#components/DropdownMenu'; | ||
|
||
import styles from './styles.module.css'; | ||
|
||
export interface Props { | ||
export interface Props<N> { | ||
name: N; |
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.
We don't need name
props for the InfoPopup
Addresses:
Changes
Storybook audit major changes
This PR doesn't introduce:
console.log
meant for debugging