aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/PremiumFeatureContainer
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-11-25 23:02:12 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-11-25 23:02:12 +0100
commit0d9c7ff6a638861d54f29bf91c82847cfa62a24c (patch)
tree1091fc0fe9b498e7b6fa69386ed2586d298d9269 /src/components/ui/PremiumFeatureContainer
parentFix delayApp issues (diff)
downloadferdium-app-0d9c7ff6a638861d54f29bf91c82847cfa62a24c.tar.gz
ferdium-app-0d9c7ff6a638861d54f29bf91c82847cfa62a24c.tar.zst
ferdium-app-0d9c7ff6a638861d54f29bf91c82847cfa62a24c.zip
Move spellchecker to premium
Diffstat (limited to 'src/components/ui/PremiumFeatureContainer')
-rw-r--r--src/components/ui/PremiumFeatureContainer/index.js64
-rw-r--r--src/components/ui/PremiumFeatureContainer/styles.js31
2 files changed, 95 insertions, 0 deletions
diff --git a/src/components/ui/PremiumFeatureContainer/index.js b/src/components/ui/PremiumFeatureContainer/index.js
new file mode 100644
index 000000000..113fe2221
--- /dev/null
+++ b/src/components/ui/PremiumFeatureContainer/index.js
@@ -0,0 +1,64 @@
1import React, { Component } from 'react';
2import { inject, observer } from 'mobx-react';
3import PropTypes from 'prop-types';
4import { defineMessages, intlShape } from 'react-intl';
5import injectSheet from 'react-jss';
6
7import { oneOrManyChildElements } from '../../../prop-types';
8
9import styles from './styles';
10
11const messages = defineMessages({
12 action: {
13 id: 'premiumFeature.button.upgradeAccount',
14 defaultMessage: '!!!Upgrade account',
15 },
16});
17
18export default @inject('actions') @injectSheet(styles) @observer class PremiumFeatureContainer extends Component {
19 static propTypes = {
20 classes: PropTypes.object.isRequired,
21 };
22
23 static contextTypes = {
24 intl: intlShape,
25 };
26
27 render() {
28 const {
29 classes,
30 children,
31 actions,
32 } = this.props;
33
34 const { intl } = this.context;
35
36 return (
37 <div className={classes.container}>
38 <div className={classes.titleContainer}>
39 <p className={classes.title}>Premium Feature</p>
40 <button
41 className={classes.actionButton}
42 type="button"
43 onClick={() => actions.ui.openSettings({ path: 'user' })}
44 >
45 {intl.formatMessage(messages.action)}
46 </button>
47 </div>
48 <div className={classes.content}>
49 {children}
50 </div>
51 </div>
52 );
53 }
54}
55
56PremiumFeatureContainer.wrappedComponent.propTypes = {
57 children: oneOrManyChildElements.isRequired,
58 actions: PropTypes.shape({
59 ui: PropTypes.shape({
60 openSettings: PropTypes.func.isRequired,
61 }).isRequired,
62 }).isRequired,
63};
64
diff --git a/src/components/ui/PremiumFeatureContainer/styles.js b/src/components/ui/PremiumFeatureContainer/styles.js
new file mode 100644
index 000000000..16c40d0ec
--- /dev/null
+++ b/src/components/ui/PremiumFeatureContainer/styles.js
@@ -0,0 +1,31 @@
1export default theme => ({
2 container: {
3 background: theme.colorSubscriptionContainerBackground,
4 border: theme.colorSubscriptionContainerBorder,
5 margin: [0, 0, 20, -20],
6 padding: 20,
7 'border-radius': theme.borderRadius,
8 },
9 titleContainer: {
10 display: 'flex',
11 },
12 title: {
13 'font-weight': 'bold',
14 color: theme.colorSubscriptionContainerTitle,
15 },
16 actionButton: {
17 background: theme.colorSubscriptionContainerActionButtonBackground,
18 color: theme.colorSubscriptionContainerActionButtonColor,
19 'margin-left': 'auto',
20 'border-radius': theme.borderRadiusSmall,
21 padding: [2, 4],
22 'font-size': 12,
23 },
24 content: {
25 opacity: 0.5,
26 'margin-top': 20,
27 '& :last-child': {
28 'margin-bottom': 0,
29 },
30 },
31});