Skip to content

Commit

Permalink
Refactor all examples to use new description prop instead of label
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudcolas committed Oct 17, 2017
1 parent 24aa8dd commit 13b5004
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 35 deletions.
16 changes: 12 additions & 4 deletions examples/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,24 @@ const editor = (
placeholder="Write here…"
onSave={onSave}
blockTypes={[
{ label: 'H3', type: BLOCK_TYPE.HEADER_THREE },
{
label: 'UL',
label: 'H3',
type: BLOCK_TYPE.HEADER_THREE,
description: 'Heading 3',
},
{
type: BLOCK_TYPE.UNORDERED_LIST_ITEM,
description: 'Bulleted list',
icon: 'icon-list-ul',
},
]}
inlineStyles={[
{ label: 'Bold', type: INLINE_STYLE.BOLD, icon: 'icon-bold' },
{ label: 'Italic', type: INLINE_STYLE.ITALIC, icon: 'icon-italic' },
{ type: INLINE_STYLE.BOLD, description: 'Bold', icon: 'icon-bold' },
{
type: INLINE_STYLE.ITALIC,
description: 'Italic',
icon: 'icon-italic',
},
]}
/>
);
Expand Down
9 changes: 7 additions & 2 deletions examples/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const editor = (
onSave={onSave}
stripPastedStyles={false}
blockTypes={[
{ label: 'H2', type: BLOCK_TYPE.HEADER_TWO },
{
label: 'H2',
type: BLOCK_TYPE.HEADER_TWO,
description: 'Heading 2',
},
{
label: 'Tiny',
type: 'tiny-text',
Expand All @@ -39,8 +43,9 @@ const editor = (
]}
inlineStyles={[
{
label: 'Bold',
type: INLINE_STYLE.BOLD,
icon: 'icon-bold',
description: 'Bold',
style: { fontWeight: 'bold', textShadow: '1px 1px 1px black' },
},
{
Expand Down
18 changes: 13 additions & 5 deletions examples/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,34 @@ const editor = (
onSave={onSave}
entityTypes={[
{
label: 'Link',
type: ENTITY_TYPE.LINK,
description: 'Link',
icon: 'icon-link',
source: LinkSource,
decorator: Link,
},
{
label: 'Document',
type: ENTITY_TYPE.DOCUMENT,
description: 'Document',
icon: 'icon-doc-full',
source: DocumentSource,
decorator: Document,
},
]}
blockTypes={[
{ label: 'H2', type: BLOCK_TYPE.HEADER_TWO },
{ label: 'H3', type: BLOCK_TYPE.HEADER_THREE },
{
label: 'Blockquote',
label: 'H2',
type: BLOCK_TYPE.HEADER_TWO,
description: 'Heading 2',
},
{
label: 'H3',
type: BLOCK_TYPE.HEADER_THREE,
description: 'Heading 3',
},
{
type: BLOCK_TYPE.BLOCKQUOTE,
description: 'Blockquote',
icon: 'icon-openquote',
},
]}
Expand Down
2 changes: 1 addition & 1 deletion examples/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const editor = (
label: 'H3',
description: 'Heading 3',
},
{ label: 'Code', type: BLOCK_TYPE.CODE, icon: 'icon-cog' },
{ label: '</>', type: BLOCK_TYPE.CODE, description: 'Code' },
{
type: BLOCK_TYPE.UNORDERED_LIST_ITEM,
description: 'Bulleted list',
Expand Down
74 changes: 51 additions & 23 deletions examples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,67 @@ const editors = (
stripPastedStyles={false}
entityTypes={[
{
label: 'Image',
type: ENTITY_TYPE.IMAGE,
description: 'Image',
icon: 'icon-image',
source: ImageSource,
imageFormats: [],
},
{
label: 'Embed',
type: ENTITY_TYPE.EMBED,
description: 'Embed',
icon: 'icon-media',
source: EmbedSource,
},
{
label: 'Link',
type: ENTITY_TYPE.LINK,
description: 'Link',
icon: 'icon-link',
source: LinkSource,
decorator: Link,
},
{
label: 'Document',
type: ENTITY_TYPE.DOCUMENT,
description: 'Document',
icon: 'icon-doc-full',
source: DocumentSource,
decorator: Document,
},
]}
blockTypes={[
{ label: 'H2', type: BLOCK_TYPE.HEADER_TWO },
{ label: 'H3', type: BLOCK_TYPE.HEADER_THREE },
{ label: 'H4', type: BLOCK_TYPE.HEADER_FOUR },
{ label: 'H5', type: BLOCK_TYPE.HEADER_FIVE },
{
label: 'Blockquote',
label: 'H2',
type: BLOCK_TYPE.HEADER_TWO,
description: 'Heading 2',
},
{
label: 'H3',
type: BLOCK_TYPE.HEADER_THREE,
description: 'Heading 3',
},
{
label: 'H4',
type: BLOCK_TYPE.HEADER_FOUR,
description: 'Heading 4',
},
{
label: 'H5',
type: BLOCK_TYPE.HEADER_FIVE,
description: 'Heading 5',
},
{
type: BLOCK_TYPE.BLOCKQUOTE,
description: 'Blockquote',
icon: 'icon-openquote',
},
{
label: 'UL',
type: BLOCK_TYPE.UNORDERED_LIST_ITEM,
description: 'Bulleted list',
icon: 'icon-list-ul',
},
{
label: 'OL',
type: BLOCK_TYPE.ORDERED_LIST_ITEM,
description: 'Numbered list',
icon: 'icon-list-ol',
},
{
Expand All @@ -86,25 +102,29 @@ const editors = (
},
]}
inlineStyles={[
{ label: 'Bold', type: INLINE_STYLE.BOLD, icon: 'icon-bold' },
{
label: 'Italic',
type: INLINE_STYLE.BOLD,
description: 'Bold',
icon: 'icon-bold',
},
{
type: INLINE_STYLE.ITALIC,
description: 'Italic',
icon: 'icon-italic',
},
{
label: 'Underline',
type: INLINE_STYLE.UNDERLINE,
description: 'Underline',
icon: 'icon-underline',
},
{
label: 'Monospace',
type: INLINE_STYLE.CODE,
icon: 'icon-pacman',
label: '</>',
description: 'Code',
},
{
label: 'Strikethrough',
type: INLINE_STYLE.STRIKETHROUGH,
description: 'Strikethrough',
icon: 'icon-strikethrough',
},
]}
Expand All @@ -121,33 +141,41 @@ const editors = (
stripPastedStyles={false}
entityTypes={[
{
label: 'Image',
type: ENTITY_TYPE.IMAGE,
description: 'Image',
icon: 'icon-image',
source: ImageSource,
imageFormats: [],
},
{
label: 'Link',
type: ENTITY_TYPE.LINK,
description: 'Link',
icon: 'icon-link',
source: LinkSource,
decorator: Link,
},
]}
blockTypes={[
{ label: 'H4', type: BLOCK_TYPE.HEADER_FOUR },
{
label: 'UL',
label: 'H4',
type: BLOCK_TYPE.HEADER_FOUR,
description: 'Heading 4',
},
{
type: BLOCK_TYPE.UNORDERED_LIST_ITEM,
description: 'Bulleted list',
icon: 'icon-list-ul',
},
]}
inlineStyles={[
{ label: 'Bold', type: INLINE_STYLE.BOLD, icon: 'icon-bold' },
{
label: 'Italic',
type: INLINE_STYLE.BOLD,
description: 'Bold',
icon: 'icon-bold',
},
{
type: INLINE_STYLE.ITALIC,
description: 'Italic',
icon: 'icon-italic',
},
]}
Expand Down

0 comments on commit 13b5004

Please sign in to comment.