about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/composer/warning/index.js
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2018-01-05 18:29:08 -0500
committerGitHub <noreply@github.com>2018-01-05 18:29:08 -0500
commitfaf20eeaa4c6f48a97a41a948ed29e734c8c4f5e (patch)
treeda0b88781650d514c209641fc6af7cbb921afe0b /app/javascript/flavours/glitch/features/composer/warning/index.js
parentf41b33eb0177b23bd72fede7df94af43da0c7c6b (diff)
parentd7ce339c2e33a5607c21d3eff316669cff9c6ea3 (diff)
Merge pull request #293 from glitch-soc/compose-refactor
Compose refactor
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer/warning/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/composer/warning/index.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/warning/index.js b/app/javascript/flavours/glitch/features/composer/warning/index.js
new file mode 100644
index 000000000..c225b50e8
--- /dev/null
+++ b/app/javascript/flavours/glitch/features/composer/warning/index.js
@@ -0,0 +1,54 @@
+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: 'Your account is not {locked}. Anyone can follow you to view your follower-only posts.',
+    id: 'compose_form.lock_disclaimer',
+  },
+  locked: {
+    defaultMessage: 'locked',
+    id: 'compose_form.lock_disclaimer.lock',
+  },
+});
+
+//  The component.
+export default function ComposerWarning () {
+  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})`,
+          }}
+        >
+          <FormattedMessage
+            {...messages.disclaimer}
+            values={{ locked: <a href='/settings/profile'><FormattedMessage {...messages.locked} /></a> }}
+          />
+        </div>
+      )}
+    </Motion>
+  );
+}
+
+ComposerWarning.propTypes = {};