try-new-editor-button.tsx 896 B

12345678910111213141516171819202122232425262728
  1. import { useCallback } from 'react'
  2. import OLButton from '../ui/components/ol/ol-button'
  3. import { useIdeRedesignSwitcherContext } from '../ide-react/context/ide-redesign-switcher-context'
  4. import MaterialIcon from '@/shared/components/material-icon'
  5. import { useTranslation } from 'react-i18next'
  6. const TryNewEditorButton = () => {
  7. const { t } = useTranslation()
  8. const { setShowSwitcherModal } = useIdeRedesignSwitcherContext()
  9. const onClick = useCallback(() => {
  10. setShowSwitcherModal(true)
  11. }, [setShowSwitcherModal])
  12. return (
  13. <div className="d-flex align-items-center">
  14. <OLButton
  15. className="toolbar-experiment-button"
  16. onClick={onClick}
  17. size="sm"
  18. leadingIcon={<MaterialIcon type="experiment" unfilled />}
  19. variant="info"
  20. >
  21. {t('try_the_new_editor')}
  22. </OLButton>
  23. </div>
  24. )
  25. }
  26. export default TryNewEditorButton