-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify the
link
view to allow all options to be passed via config
- Loading branch information
Showing
4 changed files
with
106 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,67 @@ | ||
export default { | ||
demo: { | ||
view: 'link', | ||
data: { | ||
text: 'I am link', | ||
href: '#' | ||
} | ||
text: 'I am link', | ||
href: '#example' | ||
}, | ||
examples: [ | ||
{ | ||
title: 'Link opened in new tab', | ||
highlightProps: ['external'], | ||
demo: { | ||
view: 'link', | ||
text: 'Discovery github', | ||
href: 'https://github.com/discoveryjs/discovery', | ||
external: true | ||
} | ||
}, | ||
{ | ||
title: 'Infering text ⇿ href', | ||
highlightProps: ['text', 'href', 'data'], | ||
beforeDemo: 'md:"When `text` is omitted but `href` is specified, or vice versa, the opposite component is inferred from the specified one"', | ||
demo: [ | ||
{ view: 'link', text: 'http://example1.com' }, | ||
{ view: 'link', href: 'http://example2.com' }, | ||
{ view: 'link', data: '"http://example3.com"' } | ||
] | ||
}, | ||
{ | ||
title: 'Using onClick handler', | ||
highlightProps: ['onClick'], | ||
demo: { | ||
view: 'link', | ||
text: 'Show "Hello world"', | ||
onClick: Function('return () => alert("Hello world!")')() | ||
} | ||
}, | ||
{ | ||
title: 'Using data as source of options', | ||
beforeDemo: { | ||
view: 'md', | ||
source: [ | ||
'The following properties are taken from the data when the appropriate options are not specified for a legacy reasons (is subject to remove in the future):', | ||
'- `text`', | ||
'- `href`', | ||
'- `external`' | ||
].join('\n') | ||
}, | ||
highlightProps: ['data'], | ||
demo: { | ||
view: 'link', | ||
data: { | ||
text: 'Discovery github', | ||
href: 'https://github.com/discoveryjs/discovery', | ||
external: true | ||
text: 'demo', | ||
href: '#example' | ||
} | ||
} | ||
}, | ||
{ | ||
title: 'Complex content', | ||
highlightProps: ['content'], | ||
demo: { | ||
view: 'link', | ||
href: '#example', | ||
content: ['text:"text "', 'html:"<b>bold</b>"'] | ||
} | ||
} | ||
] | ||
}; |