etr2460 commented on a change in pull request #11279:
URL: 
https://github.com/apache/incubator-superset/pull/11279#discussion_r506585559



##########
File path: superset-frontend/src/components/FacePile/FacePile.stories.tsx
##########
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import { withKnobs, number } from '@storybook/addon-knobs';
+import FacePile from '.';
+
+export default {
+  title: 'UerStack',

Review comment:
       nit: this should probably be `FacePile` for consistency

##########
File path: superset-frontend/src/components/FacePile/index.tsx
##########
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import { getCategoricalSchemeRegistry, styled } from '@superset-ui/core';
+import { Avatar, Tooltip } from 'src/common/components';
+import { getRandomColor } from './utils';
+
+interface FacePileProps {
+  users: { first_name: string; last_name: string }[];
+  maxCount?: number;
+}
+
+const colorList = getCategoricalSchemeRegistry().get()?.colors ?? [];
+
+const StyledAvatar = styled(Avatar)`
+  width: ${({ theme }) => theme.gridUnit * 6}px;
+  height: ${({ theme }) => theme.gridUnit * 6}px;
+  line-height: ${({ theme }) => theme.gridUnit * 6}px;
+  font-size: ${({ theme }) => theme.typography.sizes.xl}px;
+`;
+
+// to apply styling to the maxCount avatar
+const StyledGroup = styled(Avatar.Group)`
+  .ant-avatar {
+    width: ${({ theme }) => theme.gridUnit * 6}px;
+    height: ${({ theme }) => theme.gridUnit * 6}px;
+    line-height: ${({ theme }) => theme.gridUnit * 6}px;
+    font-size: ${({ theme }) => theme.typography.sizes.xl}px;
+  }
+`;
+
+export default function FacePile({ users, maxCount = 4 }: FacePileProps) {
+  return (
+    <StyledGroup maxCount={maxCount}>
+      {users.map(({ first_name, last_name }) => {
+        const name = `${first_name} ${last_name}`;
+        const color = getRandomColor(name, colorList);

Review comment:
       this doesn't need to be addressed in this PR, but basing the profile 
color off the full name seems somewhat flawed to me. If there are naming 
collisions between people with common full names, then it'll be impossible to 
tell them apart in the FacePile. This could also cause key collisions below.
   
   I'd recommend refactoring in the future to basing the color off the user id, 
or a combo of name + user id.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to