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

fix: long headers values #76

Merged
merged 15 commits into from
Aug 14, 2023
Merged

fix: long headers values #76

merged 15 commits into from
Aug 14, 2023

Conversation

saxumcordis
Copy link
Contributor

Fix long headers value with ellipsis

Before
image

After
image

@saxumcordis saxumcordis marked this pull request as ready for review August 8, 2023 11:49
@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@@ -24,6 +24,9 @@ export interface CardProps {
checkEmptyBody?: boolean;
}

const POPOVER_PLACEMENT: PopoverProps['placement'] = ['bottom', 'top'];
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a separate file of constants you need to take out there

@@ -112,7 +120,9 @@ export const Card: React.FC<CardProps> = ({
className={b('header', {interactive: Boolean(handleHeaderToggle)})}
onClick={handleHeaderToggle}
>
<div className={b('header-left')}>{title}</div>
<div ref={titleRef} className={b('header-left')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

ref should be on another div
right here
<div className={b('title')}>{propsTitle}</div>
otherwise it will be like this
image

LayoutProps,
Spec,
ViewLayoutProps,
type FieldRenderProps,
Copy link
Contributor

Choose a reason for hiding this comment

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

do not change code that is not related to the current task

@@ -27,6 +28,9 @@ interface SectionProps {
descriptionAsSubtitle?: boolean;
}

const POPOVER_PLACEMENT: PopoverProps['placement'] = ['bottom', 'top'];
const MAX_TITLE_WIDTH = 533;
Copy link
Contributor

Choose a reason for hiding this comment

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

move to common constants

@@ -76,15 +81,26 @@ const SectionBase = <D extends FieldValue, T extends FormValue, S extends Spec>(
}
}

const layoutTitle = spec.viewSpec.layoutTitle;
const layoutTitlePopoverDisabled = (titleRef.current?.offsetWidth || 0) < MAX_TITLE_WIDTH;
Copy link
Contributor

Choose a reason for hiding this comment

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

const layoutTitlePopoverDisabled = (titleRef.current?.offsetWidth || 0) <= MAX_TITLE_WIDTH;
image

qa={`${name}-accordeon-toggler`}
width="auto"
>
{' '}
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the extra space

@@ -9,6 +9,8 @@ import './MultiSelectView.scss';

const b = block('multiselect-view');

const POPOVER_PLACEMENT: PopoverProps['placement'] = ['bottom', 'top'];
Copy link
Contributor

Choose a reason for hiding this comment

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

these changes do not apply to the current task, you should remove them, if you want to change imports and parameters, it is better to do it in a separate task

@@ -10,14 +10,16 @@ import './NumberWithScaleView.scss';

const b = block('number-with-scale-view');

const POPOVER_PLACEMENT: PopoverProps['placement'] = ['bottom', 'top'];
Copy link
Contributor

Choose a reason for hiding this comment

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

these changes do not apply to the current task, you should remove them, if you want to change imports and parameters, it is better to do it in a separate task

@@ -97,19 +101,38 @@ export class SimpleVerticalAccordeon extends React.Component<
return null;
}

const title = this.getTitle();
const titlePopoverDisabled =
(this.titleRef.current?.offsetWidth || 0) < MAX_TITLE_TEXT_WIDTH;
Copy link
Contributor

Choose a reason for hiding this comment

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

const titlePopoverDisabled = (this.titleRef.current?.offsetWidth || 0) <= MAX_TITLE_TEXT_WIDTH;

@@ -66,22 +70,26 @@ export const Card: React.FC<CardProps> = ({
[],
);

const titlePopoverDisabled = (titleRef.current?.offsetWidth || 0) < MAX_TITLE_WIDTH;
Copy link
Contributor

Choose a reason for hiding this comment

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

const titlePopoverDisabled =
            (this.titleRef.current?.offsetWidth || 0) <= MAX_TITLE_TEXT_WIDTH;

@saxumcordis saxumcordis merged commit 37f3c6e into main Aug 14, 2023
@saxumcordis saxumcordis deleted the fix_headers branch August 14, 2023 08:25
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.

3 participants