percentInput.tsx 671 B

123456789101112131415161718192021222324252627
  1. import type React from 'react';
  2. import {css} from '@emotion/react';
  3. import styled from '@emotion/styled';
  4. import {InputGroup} from 'sentry/components/inputGroup';
  5. import {space} from 'sentry/styles/space';
  6. interface Props extends React.ComponentProps<typeof InputGroup.Input> {}
  7. export function PercentInput(props: Props) {
  8. return (
  9. <InputGroup
  10. css={css`
  11. width: 160px;
  12. `}
  13. >
  14. <InputGroup.Input type="number" {...props} />
  15. <InputGroup.TrailingItems>
  16. <TrailingPercent>%</TrailingPercent>
  17. </InputGroup.TrailingItems>
  18. </InputGroup>
  19. );
  20. }
  21. const TrailingPercent = styled('strong')`
  22. padding: 0 ${space(0.25)};
  23. `;