From 71044c39ddbce686a89a7d98cdd219bad5bf3f70 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Fri, 31 Jul 2020 00:10:13 -0700 Subject: [PATCH] link feat: New doc button on template list item --- app/components/Button.js | 1 + .../DocumentPreview/DocumentPreview.js | 26 ++++++++++++++++--- app/components/Sidebar/Settings.js | 1 - 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/app/components/Button.js b/app/components/Button.js index 146c0beae9..ef5c0128a3 100644 --- a/app/components/Button.js +++ b/app/components/Button.js @@ -113,6 +113,7 @@ export const Inner = styled.span` line-height: ${props => (props.hasIcon ? 24 : 32)}px; justify-content: center; align-items: center; + min-height: 30px; ${props => props.hasIcon && props.hasText && "padding-left: 4px;"}; ${props => props.hasIcon && !props.hasText && "padding: 0 4px;"}; diff --git a/app/components/DocumentPreview/DocumentPreview.js b/app/components/DocumentPreview/DocumentPreview.js index 72c2a16e1a..65c3815c49 100644 --- a/app/components/DocumentPreview/DocumentPreview.js +++ b/app/components/DocumentPreview/DocumentPreview.js @@ -12,6 +12,7 @@ import Highlight from "components/Highlight"; import PublishingInfo from "components/PublishingInfo"; import DocumentMenu from "menus/DocumentMenu"; import Document from "models/Document"; +import { newDocumentUrl } from "utils/routeHelpers"; type Props = { document: Document, @@ -28,18 +29,22 @@ const SEARCH_RESULT_REGEX = /]*>(.*?)<\/b>/gi; @observer class DocumentPreview extends React.Component { - star = (ev: SyntheticEvent<>) => { + handleStar = (ev: SyntheticEvent<>) => { ev.preventDefault(); ev.stopPropagation(); this.props.document.star(); }; - unstar = (ev: SyntheticEvent<>) => { + handleUnstar = (ev: SyntheticEvent<>) => { ev.preventDefault(); ev.stopPropagation(); this.props.document.unstar(); }; + handleNewFromTemplate = () => { + // + }; + replaceResultMarks = (tag: string) => { // don't use SEARCH_RESULT_REGEX here as it causes // an infinite loop to trigger a regex inside it's own callback @@ -78,9 +83,9 @@ class DocumentPreview extends React.Component { !document.isTemplate && ( {document.isStarred ? ( - + ) : ( - + )} )} @@ -97,6 +102,19 @@ class DocumentPreview extends React.Component { {document.isTemplate && showTemplate && Template} + {document.isTemplate && ( + + )}  diff --git a/app/components/Sidebar/Settings.js b/app/components/Sidebar/Settings.js index cbe0c8cad5..94242fff24 100644 --- a/app/components/Sidebar/Settings.js +++ b/app/components/Sidebar/Settings.js @@ -9,7 +9,6 @@ import { ProfileIcon, PadlockIcon, CodeIcon, - ShapesIcon, UserIcon, GroupIcon, LinkIcon,