Browse Source

ref(js): Make ParentLabel a functional component (#28683)

Evan Purkhiser 3 years ago
parent
commit
1102366d12
1 changed files with 11 additions and 18 deletions
  1. 11 18
      static/app/views/settings/account/notifications/parentLabel.tsx

+ 11 - 18
static/app/views/settings/account/notifications/parentLabel.tsx

@@ -1,4 +1,3 @@
-import React from 'react';
 import styled from '@emotion/styled';
 
 import Avatar from 'app/components/avatar';
@@ -11,23 +10,17 @@ type Props = {
   parent: OrganizationSummary | Project;
 };
 
-/** TODO(mgaeta): Infer parentKey from parent. */
-class ParentLabel extends React.Component<Props> {
-  render = () => {
-    const {notificationType, parent} = this.props;
-
-    return (
-      <FieldLabel>
-        <Avatar
-          {...{
-            [getParentKey(notificationType)]: parent,
-          }}
-        />
-        <span>{parent.slug}</span>
-      </FieldLabel>
-    );
-  };
-}
+// TODO(mgaeta): Infer parentKey from parent.
+const ParentLabel = ({notificationType, parent}: Props) => (
+  <FieldLabel>
+    <Avatar
+      {...{
+        [getParentKey(notificationType)]: parent,
+      }}
+    />
+    <span>{parent.slug}</span>
+  </FieldLabel>
+);
 
 const FieldLabel = styled('div')`
   display: flex;