Skip to content

Commit

Permalink
Merge pull request #38 from kadirahq/issue-35
Browse files Browse the repository at this point in the history
Add a confirm box when deleting components. #35
  • Loading branch information
arunoda authored Oct 13, 2016
2 parents 8ed4724 + 2faf6e3 commit 15bcad7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/manager/components/CommentItem/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint jsx-a11y/href-no-hash:0 */
/* eslint jsx-a11y/href-no-hash:0, no-undef:0, no-alert:0 */

import React, { Component } from 'react';
import moment from 'moment';
Expand Down Expand Up @@ -27,15 +27,18 @@ export default class CommentItem extends Component {
}

deleteComment() {
this.props.deleteComment();
const confirmDelete = confirm('Are you sure you want to delete this comment?');
if (confirmDelete === true) {
this.props.deleteComment();
}
}

renderDelete() {
return (
<a
href="#"
style={style.commentDelete}
onClick={this.props.deleteComment}
onClick={this.deleteComment}
>
delete
</a>
Expand Down
4 changes: 3 additions & 1 deletion src/manager/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint import/prefer-default-export:0 */

import React from 'react';
import addons from '@kadira/storybook-addons';
import CommentsPanel from './containers/CommentsPanel';
import { ADDON_ID, PANEL_ID } from '../shared';

export default function init() {
export function init() {
addons.register(ADDON_ID, (api) => {
// add 'Comments' panel
addons.addPanel(PANEL_ID, {
Expand Down
4 changes: 3 additions & 1 deletion src/preview/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export default function init() {
/* eslint import/prefer-default-export:0 */

export function init() {
// nothing to do here
}

0 comments on commit 15bcad7

Please sign in to comment.