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

[EuiDualRange] Additional inline margin added for long labels #4109

Closed
Kikky opened this issue Oct 5, 2020 · 5 comments
Closed

[EuiDualRange] Additional inline margin added for long labels #4109

Kikky opened this issue Oct 5, 2020 · 5 comments
Labels
good first issue ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible stale-issue

Comments

@Kikky
Copy link

Kikky commented Oct 5, 2020

Version: 29.3.0

With this code I get 2 range elements with different widths, because of additional inline margin to div.euiRangeTrack (margin-left: 0.8em; for first range element).

image

const [leverageRangeVal, setLeverageRangeVal] = useState<[number, number]>([30, 3000]);

  const [yearRangeVal, setYearRangeVal] = useState<[number, number]>([1974, 2020]);
  
  const onYearRangeChange = (value: React.SetStateAction<[number, number]>) => {
    setYearRangeVal(value);
  };

  const onLeverageRangeChange = (value: React.SetStateAction<[number, number]>) => {
    setLeverageRangeVal(value);
  };

<EuiPanel>
    <EuiFormRow label="Год основания:" display="rowCompressed">
      <EuiDualRange
        min={1974}
        max={2020}
        showTicks
        tickInterval={20}
        fullWidth
        onChange={onYearRangeChange}
        value={yearRangeVal}
      />
      </EuiFormRow>

      <EuiFormRow label="Кредитное плечо:" display="rowCompressed">
      <EuiDualRange
        min={30}
        max={3000}
        showTicks
        fullWidth
        tickInterval={800}
        value={leverageRangeVal}
        onChange={onLeverageRangeChange}
      />
      </EuiFormRow>
  </EuiPanel>

If I set the values from 0 to 100 like in tutorial - everything is fine and no additional inline margins appear.

is it a bug or I don't understand something? Thanks in advance.

@thompsongl
Copy link
Contributor

Thanks, @Kikky

The extra margin is added in this case because of the length of the labels, but I agree that the outcome does not meet expectations. We'll likely need to look at alternative methods for adjusting label location.

@thompsongl thompsongl changed the title Additional inline margin to range slider [EuiDualRange] Additional inline margin added for long labels Oct 5, 2020
@thompsongl thompsongl added the ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible label Oct 5, 2020
@github-actions
Copy link

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@thompsongl
Copy link
Contributor

@miukimiu Maybe keep this in mind when you look into EuiDualRange adjustments for the time slider.

@github-actions
Copy link

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

@thompsongl
Copy link
Contributor

Resolved by #4781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible stale-issue
Projects
None yet
Development

No branches or pull requests

3 participants