airbnb / lunar

🌗 React toolkit and design language for Airbnb open source and internal projects.
MIT License
464 stars 77 forks source link

fix(Autocomplete): prefix and suffix style #390

Closed moyus closed 4 years ago

moyus commented 4 years ago

to: @williaster @alecklandgraf

Description

BaseInput in Autocomplete doesn't receive hasPrefix and hasSuffix props before, which would cause style bug with <Prefix /> and <Suffix />.

The hasPrefix and hasSuffix condition check is copied from partitionFieldProps() function.

Motivation and Context

Fix style bug.

Testing

Looks good in storybook.

Screenshots

Before:

Screen Shot 2020-07-17 at 4 00 06 PM

After:

Screen Shot 2020-07-17 at 3 57 52 PM

Checklist

airbnb-bot commented 4 years ago

Size Changes

Package Diff ESM Prev ESM CJS Prev CJS
core +0.0% 566.56 KB 566.49 KB 708.61 KB 708.54 KB

Compared to master. File sizes are unminified and ungzipped.

View raw build stats

Previous (master)

{
  "apollo": {
    "esm": 10832,
    "lib": 14147
  },
  "app-shell": {
    "esm": 12906,
    "lib": 19874
  },
  "composer": {
    "esm": 68247,
    "lib": 101805
  },
  "core": {
    "esm": 580089,
    "lib": 725544
  },
  "forms": {
    "esm": 37350,
    "lib": 49298
  },
  "icons": {
    "esm": 156355,
    "lib": 205626
  },
  "layouts": {
    "esm": 15298,
    "lib": 20770
  },
  "metrics": {
    "esm": 5467,
    "lib": 7729
  },
  "test-utils": {
    "esm": 4279,
    "lib": 5937
  }
}

Current

{
  "apollo": {
    "esm": 10832,
    "lib": 14147
  },
  "app-shell": {
    "esm": 12906,
    "lib": 19874
  },
  "composer": {
    "esm": 68247,
    "lib": 101805
  },
  "core": {
    "esm": 580157,
    "lib": 725612
  },
  "forms": {
    "esm": 37350,
    "lib": 49298
  },
  "icons": {
    "esm": 156355,
    "lib": 205626
  },
  "layouts": {
    "esm": 15298,
    "lib": 20770
  },
  "metrics": {
    "esm": 5467,
    "lib": 7729
  },
  "test-utils": {
    "esm": 4279,
    "lib": 5937
  }
}

williaster commented 4 years ago

@moyus looks like this breaks getInputProps tests as several of the expected props are wrong. Would another approach be to update partitionFieldProps such that prefix and suffix are included in the inputProps it generates?

moyus commented 4 years ago

@williaster fixed, please take a look.