Skip to content
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

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open

Storybook audit #1337

wants to merge 24 commits into from

Conversation

shreeyash07
Copy link
Collaborator

@shreeyash07 shreeyash07 commented Sep 2, 2024

Addresses:

Changes

Storybook audit major changes

  • Breadcrumbs component
  • Secondary Tab/Navigation tab
  • Button
  • Input Container height
  • Modal Width
  • MultiSelectInput

This PR doesn't introduce:

  • typos
  • conflict markers
  • unwanted comments
  • temporary files, auto-generated files or secret keys
  • console.log meant for debugging
  • codegen errors

Copy link

changeset-bot bot commented Sep 2, 2024

⚠️ No Changeset found

Latest commit: 1bb82e5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines 12 to 14
interface GoBreadcrumbsProps {
routeData: RouteData[]
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface GoBreadcrumbsProps {
routeData: RouteData[]
}
interface GoBreadcrumbsProps {
routeData: RouteData[];
}

Comment on lines 35 to 36
keySelector={(datum) => datum.to}
labelSelector={(datum) => datum.label}
Copy link
Member

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.

Comment on lines +21 to +22
const rendererParams = () => ({});

Copy link
Member

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} />,
Copy link
Member

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

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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?

Comment on lines 191 to 199
.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);
}
Copy link
Member

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);
Copy link
Member

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

Copy link
Member

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;
Copy link
Member

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?

Copy link
Collaborator Author

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);
Copy link
Member

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

Copy link
Collaborator Author

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;
Copy link
Member

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

Comment on lines +151 to +158
export const ProcessButtonWithIcon: Story = {
args: {
name: 'button',
variant: 'secondary',
children: 'Process Button',
// icons:<LoaderLineIcon/>
},
};
Copy link
Member

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,
Copy link
Member

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.

Comment on lines 1 to 5
.disabled {
border-color: var(--go-ui-color-gray-40);
background-color: var(--go-ui-color-gray-40);
color: var(--go-ui-color-black);
}
Copy link
Member

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.

Comment on lines 13 to 14
padding-left:12px;
height: 24px;
Copy link
Member

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.

Copy link
Collaborator Author

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);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -1,6 +1,5 @@
.input-label {
display: flex;
padding: 0 var(--go-ui-spacing-2xs);
Copy link
Member

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?

Copy link
Collaborator Author

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} />}
Copy link
Member

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 {
Copy link
Member

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;
Copy link
Member

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

Comment on lines 7 to 10

&.modal-font-weight {
font-weight: var(--go-ui-font-weight-medium);
}
Copy link
Member

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;
Copy link
Member

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

Comment on lines +47 to +51
{icons && (
<div>
{icons}
</div>
)}
Copy link
Member

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

Copy link
Collaborator Author

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

Comment on lines 9 to 12
&.empty-message {
padding-top: 40px;
height: 200px;
}
Copy link
Member

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 />}
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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}
Copy link
Member

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?

Copy link
Collaborator Author

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.

Comment on lines 7 to 8
"buttonTitleClear":"Clear",
"buttonClearAll":"Clear All",
Copy link
Member

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"

Comment on lines 215 to 217
if (!persistentOptionPopup) {
handleHideDropdown();
}
Copy link
Member

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.

Comment on lines 386 to 387
{!readOnly && onSelectAllButtonClick
&& <div className={styles.clearAllBorder} />}
Copy link
Member

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}>
Copy link
Member

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

Comment on lines +264 to +271
const availableOptions = options.filter(
(option) => !selectedOptions?.some(
(selectedOption) => optionKeySelector(
selectedOption,
0,
) === optionKeySelector(option, 0),
),
);
Copy link
Member

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?

Comment on lines 13 to 15
.clear-all-border {
border: var(--go-ui-width-separator-thin) solid var(--go-ui-color-separator);
}
Copy link
Member

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.

Comment on lines 291 to 301
const handleSelectAll = useCallback(
() => {
if (isNotDefined(options)) {
return;
}

const allValues = options.map(keySelector);
onChange(allValues, name);
},
[options, name, onChange, keySelector],
);
Copy link
Member

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;
Copy link
Member

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.

Copy link
Collaborator Author

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

Comment on lines 26 to 27
border-bottom: var(--go-ui-width-separator-thin) solid var(--go-ui-color-separator);
padding: 0 0 2px 0;
Copy link
Member

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

Copy link
Collaborator Author

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);
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;
Copy link
Member

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',
Copy link
Member

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} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Not sure if this is the right approach.
  2. This should only be added on certain variants.

Copy link
Collaborator Author

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

Comment on lines +91 to +92
position: absolute;
left: 45%;
Copy link
Member

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

Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not used?

Copy link
Collaborator Author

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;
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants