Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

558 edit preview icon #561

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/client/containers/NoteMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export const NoteMenuBar = () => {
// ===========================================================================

const [uuidCopiedText, setUuidCopiedText] = useState<string>('')
const [isToggled, togglePreviewIcon] = useState<boolean>(false)

// not necessory to use another state here as we have previewMarkdown
// const [isToggled, togglePreviewIcon] = useState<boolean>(false)
const { previewMarkdown } = useSelector(getSettings)

// ===========================================================================
// Hooks
Expand Down Expand Up @@ -98,7 +101,7 @@ export const NoteMenuBar = () => {
_updateCodeMirrorOption('theme', darkTheme ? 'base16-light' : 'new-moon')
}
const togglePreviewHandler = () => {
togglePreviewIcon(!isToggled)
// togglePreviewIcon(!isToggled)
_togglePreviewMarkdown()
}

Expand All @@ -111,12 +114,12 @@ export const NoteMenuBar = () => {
onClick={togglePreviewHandler}
data-testid={TestID.PREVIEW_MODE}
>
{isToggled ? (
{previewMarkdown ? (
<Edit aria-hidden="true" size={18} />
) : (
<Eye aria-hidden="true" size={18} />
)}
<span className="sr-only">{isToggled ? 'Edit note' : 'Preview note'}</span>
<span className="sr-only">{previewMarkdown ? 'Edit note' : 'Preview note'}</span>
</button>
{!activeNote.scratchpad && (
<>
Expand Down
3 changes: 2 additions & 1 deletion src/client/styles/_dark.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
$dark-sidebar: #333;
$dark-editor: #3f3f3f;
$dark-seperator: #777777;

.dark {
a {
Expand Down Expand Up @@ -203,7 +204,7 @@ $dark-editor: #3f3f3f;
hr {
height: 0;
border: 0;
border-top: 2px solid darken($dark-editor, 5%);
border-top: 2px solid darken($dark-seperator, 5%);
}

blockquote {
Expand Down
1 change: 1 addition & 0 deletions src/client/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export const newNoteHandlerHelper = (
swapFolder(Folder.ALL)
}

console.log(previewMarkdown)

Choose a reason for hiding this comment

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

Please remove log

if (previewMarkdown) {
togglePreviewMarkdown()
}
Expand Down