Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Add HorizontalActionList Component #511

Merged
merged 23 commits into from
Aug 31, 2018
Merged

Add HorizontalActionList Component #511

merged 23 commits into from
Aug 31, 2018

Conversation

chrismohr
Copy link
Contributor

@chrismohr chrismohr commented Aug 22, 2018

Mocks: https://app.zeplin.io/project/5907d6451d2b06c6b36b2852/screen/5b7b17c4336cfa21f21efe87

Introduces a variation to ActionLink called "compact", which makes the link bold, has a smaller icon, and smaller gutter.

@swese44
Copy link
Contributor

swese44 commented Aug 22, 2018

what if ActionLink accepted additional props to support this? then ActionLinkList would just need a direction prop

@chrismohr
Copy link
Contributor Author

chrismohr commented Aug 23, 2018

@swese44 I like the idea of ActionLink accepting additional props to achieve the correct look, there are only two things that are different. The iconSize and gutterSize are smaller. I see couple of options to handle this. Right now I like adding a compact: boolean prop for this, we could also do a size: 'normal' | 'small', or just expose both iconSize and gutterSize. I think I like one of the first two options to limit options.

It would look like this:

    const gutterSize = compact ? GutterSize.XSMALL : GutterSize.SMALL;
    const iconSize = compact ? IconSize.SMALL : IconSize.MEDIUM;
  1. The next decision might be around what to do with the count. We could add it to actionLink as an unlinkedSuffix or unlinkedText, but I think I like leaving it out of action link, and bringing it up a level, since it's layout (6px spacing) seems pretty specific to this case.

  2. Then for ActionLinkList, I'm interested to hear how you imagined it working with the overflow menu. Would you pass in the overflow menu as an item? Or would you have it the menuButton in a column outside the ActionLinkList? Or would you add props/logic to ActionLink List to separate the items into the visible and overflow sets? Something else?

@chrismohr chrismohr changed the title [wip] add post action link list Add MessageActionList Component Aug 28, 2018
@@ -16,7 +16,12 @@ export interface BaseActionLinkProps extends BaseComponentProps {
/**
* The visible text.
*/
text: string;
text: string | React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this remain only string? it looks like you solved this with only string and we probably don't want to allow arbitrary markup here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

* A set of links that dispaly in a horizontal list below a message post. When a maxVisibleItemCount
* prop is provided, items that exceed this value will show in a overflow menu.
*/
export class MessageActionsList extends React.Component<MessageActionsListProps & CustomizableComponentProps> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to name this something more generic so can be associated with a content item rather than Message. i'd expect to see yammer-web-components owning a <MessageActionsList> component which feeds the correct message-specific actions to this reusable UI component. maybe this could just be HorizontalActionList, or CompactActionList, ContentActionList... i don't think i'm coming up with any winners though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. @cainhimself do you have any ideas or opinions here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opted for HorizontalActionList.

maxVisibleItemCount?: number;
}

export type MessageActionsListItem = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we're duplicating ActionLink props, but losing the nuance of it's compound prop types (link or clickable). should we remove this interface and set line 9 to items: ActionItemProps[]?

Copy link
Contributor Author

@chrismohr chrismohr Aug 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree this could be better. There are two things that led me to create the new interface here.

  1. ActionLink has an optional ariaLabel, menuButton requires it.
  2. Currently unlinkedText is rendered by the list component, not the ActionLink.

I'll try to figure something out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so menuButton options have to be onclick handlers, not hyperlinks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your call on this, whether it makes sense to extend ActionItemProps[] or not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I've improved it. Let me know what you think.

@chrismohr chrismohr changed the title Add MessageActionList Component Add HorizontalActionList Component Aug 29, 2018
@@ -15,7 +15,7 @@ export default class AppContainer extends React.Component<NestableBaseComponentP
const { children, className, theme = defaultTheme } = this.props;
const classNames = getClassNames({ theme });
return (
<Fabric>
<Fabric theme={theme}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to double check this when you merge from master as Donnie's PR has been merged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I see it's conflicting. I'll resolve it.

@swese44
Copy link
Contributor

swese44 commented Aug 30, 2018

is there anything blocking this merge so we can start the MC import?

@chrismohr
Copy link
Contributor Author

@swese44, please feel free to merge this if it unblocks you.

@cainhimself is looking for changes to the menuButton spacing, but I'm happy to do this in a new PR next week.

@swese44
Copy link
Contributor

swese44 commented Aug 31, 2018

cool thanks

@swese44 swese44 merged commit b2c657c into master Aug 31, 2018
@swese44 swese44 deleted the postLinks branch August 31, 2018 17:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants