StoryShop / app

Frontend app for storyshopapp.com
14 stars 4 forks source link

label chooser component, with list and add #101

Closed joshdmiller closed 8 years ago

joshdmiller commented 8 years ago

Overview

Create a component that will draw out a list of provided tags, with the option to "take an action" by clicking one of them, and to edit.

Spec

Component Signature

type Props = {
  labels: Array<Label>,
  onAdd: ?( value: string ) => void,
  onSelect: ?( _id: string ) => void,
  onDelete: ?( _id: string ) => void,
  onChange: ?( _id: string, value: string ) => void,
};

type Label = {
  _id: string,
  value: string,
};

Render

It should render a material List component, with a ListItem for each label provided. The label value should be the primary text. The left icon should be a label/tag icon; the right/secondary action icon should be a pencil icon.

The last item in the list should be a static list item with the value "Add Label" and a left icon of a plus/add icon.

Lifecycle

For labels, the primary action should fire the onSelect callback. The secondary action should open a dialog with the ability to alter the label's value and delete the label. On value change, fire the onChange callback. On delete, the onDelete callback.

For the add link, the primary action should open a dialog with a space to enter a new label value. There is no secondary action.

UI

Inspired by Google Keep (see screenshots below), but using default mui styling.

2016-09-22-121807_275x259_scrot 2016-09-22-121837_247x102_scrot

This is for reference only. It does not match the above spec.

joshdmiller commented 8 years ago

@sethmerrick Would you like to revisit the design on this?