about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/composer/direct_warning/index.js
blob: d1febdd1bad2327203fbb98c34692ac55f8f8f80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react';
import Motion from 'flavours/glitch/util/optional_motion';
import spring from 'react-motion/lib/spring';
import { defineMessages, FormattedMessage } from 'react-intl';

//  This is the spring used with our motion.
const motionSpring = spring(1, { damping: 35, stiffness: 400 });

//  Messages.
const messages = defineMessages({
  disclaimer: {
    defaultMessage: 'This toot will only be sent to all the mentioned users.',
    id: 'compose_form.direct_message_warning',
  },
  learn_more: {
    defaultMessage: 'Learn more',
    id: 'compose_form.direct_message_warning_learn_more'
  }
});

//  The component.
export default function ComposerDirectWarning () {
  return (
    <Motion
      defaultStyle={{
        opacity: 0,
        scaleX: 0.85,
        scaleY: 0.75,
      }}
      style={{
        opacity: motionSpring,
        scaleX: motionSpring,
        scaleY: motionSpring,
      }}
    >
      {({ opacity, scaleX, scaleY }) => (
        <div
          className='composer--warning'
          style={{
            opacity: opacity,
            transform: `scale(${scaleX}, ${scaleY})`,
          }}
        >
          <span>
            <FormattedMessage {...messages.disclaimer} /> <a href='/terms' target='_blank'><FormattedMessage {...messages.learn_more} /></a>
          </span>
        </div>
      )}
    </Motion>
  );
}

ComposerDirectWarning.propTypes = {};