inputGroup.stories.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import styled from '@emotion/styled';
  2. import Button from 'sentry/components/button';
  3. import {
  4. Input,
  5. InputGroup,
  6. InputLeadingItems,
  7. InputTrailingItems,
  8. } from 'sentry/components/inputGroup';
  9. import {IconClose} from 'sentry/icons/iconClose';
  10. import {IconSearch} from 'sentry/icons/iconSearch';
  11. import space from 'sentry/styles/space';
  12. export default {
  13. title: 'Components/Input Group',
  14. args: {
  15. size: 'md',
  16. disabled: false,
  17. monospace: false,
  18. readOnly: false,
  19. placeholder: 'Search…',
  20. },
  21. argTypes: {
  22. size: {
  23. options: ['md', 'sm', 'xs'],
  24. control: {type: 'inline-radio'},
  25. },
  26. },
  27. };
  28. export const _Default = ({...args}) => {
  29. return (
  30. <InputGroup>
  31. <InputLeadingItems disablePointerEvents>
  32. <IconSearch size="sm" color="subText" />
  33. </InputLeadingItems>
  34. <Input {...args} />
  35. <InputTrailingItems>
  36. <StyledButton borderless>
  37. <IconClose size="xs" color="subText" />
  38. </StyledButton>
  39. </InputTrailingItems>
  40. </InputGroup>
  41. );
  42. };
  43. const StyledButton = styled(Button)`
  44. color: ${p => p.theme.subText};
  45. padding: ${space(0.5)};
  46. min-height: 0;
  47. height: auto;
  48. `;