You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.5 KiB

  1. import React from 'react';
  2. import Motion from 'flavours/glitch/util/optional_motion';
  3. import spring from 'react-motion/lib/spring';
  4. import { defineMessages, FormattedMessage } from 'react-intl';
  5. import { termsLink} from 'flavours/glitch/util/backend_links';
  6. // This is the spring used with our motion.
  7. const motionSpring = spring(1, { damping: 35, stiffness: 400 });
  8. // Messages.
  9. const messages = defineMessages({
  10. disclaimer: {
  11. defaultMessage: 'This toot will only be sent to all the mentioned users.',
  12. id: 'compose_form.direct_message_warning',
  13. },
  14. learn_more: {
  15. defaultMessage: 'Learn more',
  16. id: 'compose_form.direct_message_warning_learn_more'
  17. }
  18. });
  19. // The component.
  20. export default function ComposerDirectWarning () {
  21. return (
  22. <Motion
  23. defaultStyle={{
  24. opacity: 0,
  25. scaleX: 0.85,
  26. scaleY: 0.75,
  27. }}
  28. style={{
  29. opacity: motionSpring,
  30. scaleX: motionSpring,
  31. scaleY: motionSpring,
  32. }}
  33. >
  34. {({ opacity, scaleX, scaleY }) => (
  35. <div
  36. className='composer--warning'
  37. style={{
  38. opacity: opacity,
  39. transform: `scale(${scaleX}, ${scaleY})`,
  40. }}
  41. >
  42. <span>
  43. <FormattedMessage {...messages.disclaimer} />
  44. { termsLink !== undefined && <a href={termsLink} target='_blank'><FormattedMessage {...messages.learn_more} /></a> }
  45. </span>
  46. </div>
  47. )}
  48. </Motion>
  49. );
  50. }
  51. ComposerDirectWarning.propTypes = {};