Skip to content

Commit

Permalink
docs(copytext): updates Copy Text docs (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
anechol authored Dec 13, 2024
1 parent 783c94d commit 69ecac5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
10 changes: 5 additions & 5 deletions libs/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export namespace Components {
}
interface PdsCopytext {
/**
* Determines whether `copytext` should have a border.
* Determines whether `copytext` should have a visible border.
* @defaultValue true
*/
"border": boolean;
Expand All @@ -323,7 +323,7 @@ export namespace Components {
*/
"truncate": boolean;
/**
* String that is displayed and that is also copied to the clipboard upon interaction.
* The string displayed that is also copied to the clipboard upon interaction.
*/
"value": string;
}
Expand Down Expand Up @@ -1764,7 +1764,7 @@ declare namespace LocalJSX {
}
interface PdsCopytext {
/**
* Determines whether `copytext` should have a border.
* Determines whether `copytext` should have a visible border.
* @defaultValue true
*/
"border"?: boolean;
Expand All @@ -1778,7 +1778,7 @@ declare namespace LocalJSX {
*/
"fullWidth"?: boolean;
/**
* Event when copyText button is clicked.
* Event fired when copyText button is clicked.
*/
"onPdsCopyTextClick"?: (event: PdsCopytextCustomEvent<any>) => void;
/**
Expand All @@ -1787,7 +1787,7 @@ declare namespace LocalJSX {
*/
"truncate"?: boolean;
/**
* String that is displayed and that is also copied to the clipboard upon interaction.
* The string displayed that is also copied to the clipboard upon interaction.
*/
"value": string;
}
Expand Down
20 changes: 16 additions & 4 deletions libs/core/src/components/pds-copytext/docs/pds-copytext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@ import { components } from '../../../../dist/docs.json';

# Copy Text

A component to use in places where "copy" text is provided to be copied elsewhere.
The Copy Text component is a button that enables users to copy text to their clipboard upon interaction.

## Guidelines

### When to Use

- When the user needs to copy specific, valuable text to the clipboard, such as URLs, emails, API keys, and other important information.

### When Not to Use

- When the user needs to copy a large amount of non-specific or dynamically-changing text.

## Properties

<DocArgsTable componentName="pds-copytext" docSource={components} />

### Default

The default copy text button.

<DocCanvas client:only
mdxSource={{
react: '<PdsCopytext value="Copy this text"></PdsCopytext>',
Expand All @@ -21,7 +33,7 @@ A component to use in places where "copy" text is provided to be copied elsewher

### Borderless

When `border` is set to `false`, the component will not have a border.
When `border` is set to `false`, the component will not have a visible border.

<DocCanvas client:only
mdxSource={{
Expand All @@ -33,7 +45,7 @@ When `border` is set to `false`, the component will not have a border.

### Full width

When `full-width` is set to `true`, the component will take up the full width of its container.
When `full-width` is set to `true`, the component will occupy the full width of its parent container.

<DocCanvas client:only
mdxSource={{
Expand All @@ -45,7 +57,7 @@ When `full-width` is set to `true`, the component will take up the full width of

### Truncate

When `truncate` is set to `true`, the value text will be truncated and an ellipsis added.
When `truncate` is set to `true`, long value text will be truncated with an ellipsis added to the end. The full value will still be copied to the clipboard when clicked.

<DocCanvas client:only
mdxSource={{
Expand Down
6 changes: 3 additions & 3 deletions libs/core/src/components/pds-copytext/pds-copytext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { copy as copyIcon } from '@pine-ds/icons/icons';
})
export class PdsCopytext {
/**
* Determines whether `copytext` should have a border.
* Determines whether `copytext` should have a visible border.
* @defaultValue true
*/
@Prop({ reflect: true }) border = true;
Expand All @@ -32,12 +32,12 @@ export class PdsCopytext {
@Prop() truncate = false;

/**
* String that is displayed and that is also copied to the clipboard upon interaction.
* The string displayed that is also copied to the clipboard upon interaction.
*/
@Prop() value!: string;

/**
* Event when copyText button is clicked.
* Event fired when copyText button is clicked.
*/
@Event() pdsCopyTextClick: EventEmitter;

Expand Down
20 changes: 10 additions & 10 deletions libs/core/src/components/pds-copytext/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

## Properties

| Property | Attribute | Description | Type | Default |
| -------------------- | -------------- | ----------------------------------------------------------------------------------- | --------- | ----------- |
| `border` | `border` | Determines whether `copytext` should have a border. | `boolean` | `true` |
| `componentId` | `component-id` | A unique identifier used for the underlying component `id` attribute. | `string` | `undefined` |
| `fullWidth` | `full-width` | Determines whether `copytext` should expand to the full width of its container. | `boolean` | `false` |
| `truncate` | `truncate` | Determines whether the `value` should truncate and display with an ellipsis. | `boolean` | `false` |
| `value` _(required)_ | `value` | String that is displayed and that is also copied to the clipboard upon interaction. | `string` | `undefined` |
| Property | Attribute | Description | Type | Default |
| -------------------- | -------------- | ------------------------------------------------------------------------------- | --------- | ----------- |
| `border` | `border` | Determines whether `copytext` should have a visible border. | `boolean` | `true` |
| `componentId` | `component-id` | A unique identifier used for the underlying component `id` attribute. | `string` | `undefined` |
| `fullWidth` | `full-width` | Determines whether `copytext` should expand to the full width of its container. | `boolean` | `false` |
| `truncate` | `truncate` | Determines whether the `value` should truncate and display with an ellipsis. | `boolean` | `false` |
| `value` _(required)_ | `value` | The string displayed that is also copied to the clipboard upon interaction. | `string` | `undefined` |


## Events

| Event | Description | Type |
| ------------------ | -------------------------------------- | ------------------ |
| `pdsCopyTextClick` | Event when copyText button is clicked. | `CustomEvent<any>` |
| Event | Description | Type |
| ------------------ | -------------------------------------------- | ------------------ |
| `pdsCopyTextClick` | Event fired when copyText button is clicked. | `CustomEvent<any>` |


## Dependencies
Expand Down

0 comments on commit 69ecac5

Please sign in to comment.