mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(code-snippet): add wrapText prop
This commit is contained in:
parent
e1ee3a6092
commit
48bd19f75e
4 changed files with 32 additions and 2 deletions
|
@ -24,6 +24,13 @@
|
|||
*/
|
||||
export let hideCopyButton = false;
|
||||
|
||||
/**
|
||||
* Set to `true` to wrap the text
|
||||
* Note that `type` must be "multi"
|
||||
* @type {boolean} [wrapText=false]
|
||||
*/
|
||||
export let wrapText = false;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable the light variant
|
||||
* @type {boolean} [light=false]
|
||||
|
@ -121,7 +128,8 @@
|
|||
{type === 'inline' && 'bx--btn--copy'}
|
||||
{expanded && 'bx--snippet--expand'}
|
||||
{light && 'bx--snippet--light'}
|
||||
{hideCopyButton && 'bx--snippet--no-copy'}"
|
||||
{hideCopyButton && 'bx--snippet--no-copy'}
|
||||
{wrapText && 'bx--snippet--wraptext'}"
|
||||
{...$$restProps}
|
||||
>
|
||||
<code id="{id}">
|
||||
|
@ -138,7 +146,8 @@
|
|||
{type === 'inline' && 'bx--btn--copy'}
|
||||
{expanded && 'bx--snippet--expand'}
|
||||
{light && 'bx--snippet--light'}
|
||||
{hideCopyButton && 'bx--snippet--no-copy'}"
|
||||
{hideCopyButton && 'bx--snippet--no-copy'}
|
||||
{wrapText && 'bx--snippet--wraptext'}"
|
||||
{...$$restProps}
|
||||
on:click
|
||||
on:mouseover
|
||||
|
@ -157,6 +166,7 @@
|
|||
class:bx--snippet--expand="{expanded}"
|
||||
class:bx--snippet--light="{light}"
|
||||
class:bx--snippet--no-copy="{hideCopyButton}"
|
||||
class:bx--snippet--wraptext="{wrapText}"
|
||||
{...$$restProps}
|
||||
class="{type && `bx--snippet--${type}`} {$$restProps.class}"
|
||||
on:mouseover
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue