sectionToggleButton.tsx 717 B

1234567891011121314151617181920212223242526272829303132
  1. import styled from '@emotion/styled';
  2. import {Button} from 'sentry/components/button';
  3. import {t} from 'sentry/locale';
  4. interface SectionToggleButtonProps {
  5. isExpanded: boolean;
  6. onExpandChange: (state: boolean) => void;
  7. }
  8. function SectionToggleButton({
  9. isExpanded,
  10. onExpandChange,
  11. ...props
  12. }: SectionToggleButtonProps) {
  13. return (
  14. <ToggleButton priority="link" onClick={() => onExpandChange(!isExpanded)} {...props}>
  15. {isExpanded ? t('Hide Details') : t('Show Details')}
  16. </ToggleButton>
  17. );
  18. }
  19. const ToggleButton = styled(Button)`
  20. color: ${p => p.theme.subText};
  21. :hover,
  22. :focus {
  23. color: ${p => p.theme.textColor};
  24. }
  25. font-weight: bold;
  26. `;
  27. export default SectionToggleButton;