diff --git a/src/CollaboratorIcons.tsx b/src/CollaboratorIcons.tsx index ebf50ad..0266531 100644 --- a/src/CollaboratorIcons.tsx +++ b/src/CollaboratorIcons.tsx @@ -1,7 +1,10 @@ import classNames from 'classnames'; import * as React from 'react'; +import { Icon } from './Button'; +import card from './styles/cards.scss'; import style from './styles/collaborator-icons.scss'; import flex from './styles/flex.scss'; +import { Transition } from './Transition'; export interface User { id: string; @@ -72,13 +75,28 @@ export function CollaboratorIcons({}) { }; }, [needSpace]); + const [open, setOpen] = React.useState(false); + return (
{shrink ? ( -
{users.length}
+ <> +
setOpen(!open)}> + {open ? : users.length} +
+ + {users.map(user => ( + + ))} + + ) : ( users.map(user => ( void; + onSelect?: (id: string) => void; } function Item({ user, open, onSelect }: ItemProps) { @@ -108,7 +126,7 @@ function Item({ user, open, onSelect }: ItemProps) { !user.asset && style.nothing )} style={{ backgroundColor: user.color }} - onClick={() => onSelect(user.id)} + onClick={() => onSelect && onSelect(user.id)} > {open ? (
diff --git a/src/styles/collaborator-icons.scss b/src/styles/collaborator-icons.scss index 8e7b673..80e7844 100644 --- a/src/styles/collaborator-icons.scss +++ b/src/styles/collaborator-icons.scss @@ -19,6 +19,7 @@ $gap: 5px; padding: 4px $overlap; margin-right: 4px; overflow: hidden; + position: static; // for .popout } .item { @@ -103,8 +104,21 @@ $gap: 5px; justify-content: center; align-items: center; cursor: pointer; - background-color: $inactiveColor; + background-color: $activeColor; &:hover { - background-color: $activeColor; + background-color: $textColor; + } +} + +.popout { + @include transition(transform); + position: absolute; + top: 42px; + padding: 8px; + max-height: 224; + overflow: scroll; + transform-origin: top center; + &.exiting { + transform: scaleY(0); } }