Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
Add edit card in inbox, close #40, close #38
Browse files Browse the repository at this point in the history
  • Loading branch information
pm5 committed May 20, 2018
1 parent 42e5aad commit 63d3dd7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
5 changes: 3 additions & 2 deletions sensemap/src/components/Inbox/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ export default function Card(props: Props) {
<div className={className}>
<Reveal animated="fade">
<Reveal.Content hidden>
<CardAction />
<CardAction card={card} />
</Reveal.Content>
<Reveal.Content visible>
/* XXX a hack */
<Reveal.Content visible style={{ pointerEvents: 'none' }}>
<div className="card__body">
<div className="card__summary">
{card.summary}
Expand Down
32 changes: 29 additions & 3 deletions sensemap/src/components/Inbox/CardActions/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
import * as React from 'react';
import { connect } from 'react-redux';
import * as T from '../../../types';
import * as OE from '../../../types/object-editor';
import { Button } from 'semantic-ui-react';
import './index.css';

interface Props {
interface StateFromProps {}

interface DispatchFromProps {
actions: {
selectObject(status: OE.Status): T.ActionChain,
};
}

interface OwnProps {
card: T.CardData;
}

export default function CardActions(props: Props) {
type Props = StateFromProps & DispatchFromProps & OwnProps;

function CardActions({ card, actions }: Props) {
return (
<div className="card-actions">
<Button icon="edit" />
<Button
icon="edit"
onClick={() => actions.selectObject(OE.editCard(card))}
/>
<Button icon="plus square outline" />
<Button icon="trash" />
</div>
);
}

export default connect<StateFromProps, DispatchFromProps>(
(state: T.State) => ({}),
(dispatch: T.Dispatch) => ({
actions: {
selectObject: (status: OE.Status) => dispatch(T.actions.editor.selectObject(status)),
}
})
)(CardActions);

0 comments on commit 63d3dd7

Please sign in to comment.