about summary refs log tree commit diff
path: root/app/javascript/mastodon/components/avatar_overlay.js
diff options
context:
space:
mode:
authorkawax <kawaxbiz@gmail.com>2017-05-03 18:43:37 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-03 11:43:37 +0200
commit383c0b780282e4ca2a9df2086166a576eef0f296 (patch)
tree76c4b2e6d4f7633a1a4608b8983d6644329805e6 /app/javascript/mastodon/components/avatar_overlay.js
parentbf8031e984a95827fd50591ea5ae3dbc4c2f004b (diff)
Show boosted user's avatar (#2518)
* Show boosted user's avatar

* add .status__avatar-boost

* margin

* apply to notifications too.

* account__avatar-boost

* Add inline prop to Avatar component

* Add AvatarOverlay component

* rename mixins.scss

* move files for latest master

* fixed for webpack
Diffstat (limited to 'app/javascript/mastodon/components/avatar_overlay.js')
-rw-r--r--app/javascript/mastodon/components/avatar_overlay.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/javascript/mastodon/components/avatar_overlay.js b/app/javascript/mastodon/components/avatar_overlay.js
new file mode 100644
index 000000000..afa0c6667
--- /dev/null
+++ b/app/javascript/mastodon/components/avatar_overlay.js
@@ -0,0 +1,30 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+class AvatarOverlay extends React.PureComponent {
+  render() {
+    const {staticSrc, overlaySrc} = this.props;
+
+    const baseStyle = {
+      backgroundImage: `url(${staticSrc})`
+    };
+
+    const overlayStyle = {
+      backgroundImage: `url(${overlaySrc})`
+    };
+
+    return (
+      <div className='account__avatar-overlay'>
+        <div className="account__avatar-overlay-base" style={baseStyle} />
+        <div className="account__avatar-overlay-overlay" style={overlayStyle} />
+      </div>
+    );
+  }
+}
+
+AvatarOverlay.propTypes = {
+  staticSrc: PropTypes.string.isRequired,
+  overlaySrc: PropTypes.string.isRequired,
+};
+
+export default AvatarOverlay;