Add success notice style (#5242
* Add success notice style * Move quote styling closer to notices Improving parsing of notices when pasting from other tools
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
|||||||
ClockIcon,
|
ClockIcon,
|
||||||
CalendarIcon,
|
CalendarIcon,
|
||||||
MathIcon,
|
MathIcon,
|
||||||
|
DoneIcon,
|
||||||
} from "outline-icons";
|
} from "outline-icons";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
@@ -116,6 +117,7 @@ export default function blockMenuItems(dictionary: Dictionary): MenuItem[] {
|
|||||||
name: "blockquote",
|
name: "blockquote",
|
||||||
title: dictionary.quote,
|
title: dictionary.quote,
|
||||||
icon: <BlockQuoteIcon />,
|
icon: <BlockQuoteIcon />,
|
||||||
|
keywords: "blockquote pullquote",
|
||||||
shortcut: `${metaDisplay} ]`,
|
shortcut: `${metaDisplay} ]`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -173,6 +175,13 @@ export default function blockMenuItems(dictionary: Dictionary): MenuItem[] {
|
|||||||
keywords: "notice card information",
|
keywords: "notice card information",
|
||||||
attrs: { style: "info" },
|
attrs: { style: "info" },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "container_notice",
|
||||||
|
title: dictionary.successNotice,
|
||||||
|
icon: <DoneIcon />,
|
||||||
|
keywords: "notice card success",
|
||||||
|
attrs: { style: "success" },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "container_notice",
|
name: "container_notice",
|
||||||
title: dictionary.warningNotice,
|
title: dictionary.warningNotice,
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ export default function useDictionary() {
|
|||||||
showSource: t("Show source"),
|
showSource: t("Show source"),
|
||||||
warning: t("Warning"),
|
warning: t("Warning"),
|
||||||
warningNotice: t("Warning notice"),
|
warningNotice: t("Warning notice"),
|
||||||
|
success: t("Success"),
|
||||||
|
successNotice: t("Success notice"),
|
||||||
insertDate: t("Current date"),
|
insertDate: t("Current date"),
|
||||||
insertTime: t("Current time"),
|
insertTime: t("Current time"),
|
||||||
insertDateTime: t("Current date and time"),
|
insertDateTime: t("Current date and time"),
|
||||||
|
|||||||
2
app/typings/styled-components.d.ts
vendored
2
app/typings/styled-components.d.ts
vendored
@@ -53,6 +53,8 @@ declare module "styled-components" {
|
|||||||
noticeTipText: string;
|
noticeTipText: string;
|
||||||
noticeWarningBackground: string;
|
noticeWarningBackground: string;
|
||||||
noticeWarningText: string;
|
noticeWarningText: string;
|
||||||
|
noticeSuccessBackground: string;
|
||||||
|
noticeSuccessText: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Colors {
|
interface Colors {
|
||||||
|
|||||||
@@ -651,9 +651,23 @@ h6 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notice-block.success {
|
||||||
|
background: ${transparentize(0.9, props.theme.noticeSuccessBackground)};
|
||||||
|
border-left: 4px solid ${props.theme.noticeSuccessBackground};
|
||||||
|
color: ${props.theme.noticeSuccessText};
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: ${props.theme.noticeSuccessBackground};
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: ${props.theme.noticeSuccessText};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-left: 1.5em;
|
padding: 8px 10px 8px 1.5em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Token from "markdown-it/lib/token";
|
import Token from "markdown-it/lib/token";
|
||||||
import { WarningIcon, InfoIcon, StarredIcon } from "outline-icons";
|
import { WarningIcon, InfoIcon, StarredIcon, DoneIcon } from "outline-icons";
|
||||||
import { wrappingInputRule } from "prosemirror-inputrules";
|
import { wrappingInputRule } from "prosemirror-inputrules";
|
||||||
import { NodeSpec, Node as ProsemirrorNode, NodeType } from "prosemirror-model";
|
import { NodeSpec, Node as ProsemirrorNode, NodeType } from "prosemirror-model";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
@@ -14,6 +14,7 @@ export default class Notice extends Node {
|
|||||||
return Object.entries({
|
return Object.entries({
|
||||||
info: this.options.dictionary.info,
|
info: this.options.dictionary.info,
|
||||||
warning: this.options.dictionary.warning,
|
warning: this.options.dictionary.warning,
|
||||||
|
success: this.options.dictionary.success,
|
||||||
tip: this.options.dictionary.tip,
|
tip: this.options.dictionary.tip,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -47,6 +48,28 @@ export default class Notice extends Node {
|
|||||||
? "tip"
|
? "tip"
|
||||||
: dom.className.includes("warning")
|
: dom.className.includes("warning")
|
||||||
? "warning"
|
? "warning"
|
||||||
|
: dom.className.includes("success")
|
||||||
|
? "success"
|
||||||
|
: undefined,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
// Quill editor parsing
|
||||||
|
{
|
||||||
|
tag: "div.ql-hint",
|
||||||
|
preserveWhitespace: "full",
|
||||||
|
getAttrs: (dom: HTMLDivElement) => ({
|
||||||
|
style: dom.dataset.hint,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
// GitBook parsing
|
||||||
|
{
|
||||||
|
tag: "div.alert.theme-admonition",
|
||||||
|
preserveWhitespace: "full",
|
||||||
|
getAttrs: (dom: HTMLDivElement) => ({
|
||||||
|
style: dom.className.includes("warning")
|
||||||
|
? "warning"
|
||||||
|
: dom.className.includes("success")
|
||||||
|
? "success"
|
||||||
: undefined,
|
: undefined,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -75,6 +98,8 @@ export default class Notice extends Node {
|
|||||||
component = <StarredIcon />;
|
component = <StarredIcon />;
|
||||||
} else if (node.attrs.style === "warning") {
|
} else if (node.attrs.style === "warning") {
|
||||||
component = <WarningIcon />;
|
component = <WarningIcon />;
|
||||||
|
} else if (node.attrs.style === "success") {
|
||||||
|
component = <DoneIcon />;
|
||||||
} else {
|
} else {
|
||||||
component = <InfoIcon />;
|
component = <InfoIcon />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,6 +299,8 @@
|
|||||||
"Show source": "Show source",
|
"Show source": "Show source",
|
||||||
"Warning": "Warning",
|
"Warning": "Warning",
|
||||||
"Warning notice": "Warning notice",
|
"Warning notice": "Warning notice",
|
||||||
|
"Success": "Success",
|
||||||
|
"Success notice": "Success notice",
|
||||||
"Current date": "Current date",
|
"Current date": "Current date",
|
||||||
"Current time": "Current time",
|
"Current time": "Current time",
|
||||||
"Current date and time": "Current date and time",
|
"Current date and time": "Current date and time",
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const defaultColors: Colors = {
|
|||||||
purple: "#9E5CF7",
|
purple: "#9E5CF7",
|
||||||
blue: "#3633FF",
|
blue: "#3633FF",
|
||||||
marine: "#2BC2FF",
|
marine: "#2BC2FF",
|
||||||
green: "#42DED1",
|
green: "#3ad984",
|
||||||
yellow: "#F5BE31",
|
yellow: "#F5BE31",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -90,6 +90,8 @@ const buildBaseTheme = (input: Partial<Colors>) => {
|
|||||||
noticeTipText: colors.almostBlack,
|
noticeTipText: colors.almostBlack,
|
||||||
noticeWarningBackground: "#d73a49",
|
noticeWarningBackground: "#d73a49",
|
||||||
noticeWarningText: colors.almostBlack,
|
noticeWarningText: colors.almostBlack,
|
||||||
|
noticeSuccessBackground: colors.brand.green,
|
||||||
|
noticeSuccessText: colors.almostBlack,
|
||||||
tableSelectedBackground: transparentize(0.8, colors.accent),
|
tableSelectedBackground: transparentize(0.8, colors.accent),
|
||||||
breakpoints,
|
breakpoints,
|
||||||
...colors,
|
...colors,
|
||||||
@@ -230,6 +232,7 @@ export const buildDarkTheme = (input: Partial<Colors>): DefaultTheme => {
|
|||||||
noticeInfoText: colors.white,
|
noticeInfoText: colors.white,
|
||||||
noticeTipText: colors.white,
|
noticeTipText: colors.white,
|
||||||
noticeWarningText: colors.white,
|
noticeWarningText: colors.white,
|
||||||
|
noticeSuccessText: colors.white,
|
||||||
progressBarBackground: colors.slate,
|
progressBarBackground: colors.slate,
|
||||||
scrollbarBackground: colors.black,
|
scrollbarBackground: colors.black,
|
||||||
scrollbarThumb: colors.lightBlack,
|
scrollbarThumb: colors.lightBlack,
|
||||||
|
|||||||
Reference in New Issue
Block a user