Skip to content

Commit

Permalink
fix(copytext): convert to use pds-button
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelflips committed Jul 11, 2023
1 parent 58ddc8a commit caa5f25
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
22 changes: 15 additions & 7 deletions libs/core/src/components/pds-copytext/pds-copytext.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
--spacing-xs: var(--pine-spacing-xs); // 8px
--spacing-xxs: var(--pine-spacing-xxs); // 4px

button {
pds-button {
align-items: center;
background: var(--background);
border: 0;
border-radius: var(--border-radius);
display: flex;
display: inline-flex;
font-size: var(--font-size);
font-weight: var(--font-weight);
max-width: 100%;
Expand Down Expand Up @@ -50,7 +50,7 @@
border: 0;
padding: 0;

button {
pds-button {
padding: 0;

&:hover {
Expand All @@ -76,9 +76,11 @@
// full width

&:host(.pds-copytext--full-width) {
display: flex;
width: 100%;

button {
pds-button {
display: flex;
justify-content: space-between;
width: 100%;

Expand All @@ -92,10 +94,16 @@
// truncated

&:host(.pds-copytext--truncated) {
span {
overflow: hidden;
text-overflow: ellipsis;
pds-button {
display: flex;
width: 100%;

span {
overflow: hidden;
text-align: left;
text-overflow: ellipsis;
width: 100%;
}
}
}
}
4 changes: 2 additions & 2 deletions libs/core/src/components/pds-copytext/pds-copytext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export class PdsCopytext {
render() {
return (
<Host class={this.classNames()} id={this.componentId}>
<button type="button" onClick={() => this.copyToClipboard(this.value)}>
<pds-button type="button" variant="unstyled" onClick={() => this.copyToClipboard(this.value)}>
<span>{this.value}</span>
<pds-icon name="copy" size="16px"></pds-icon>
</button>
</pds-button>
</Host>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ A small component to use in places where "copy" text is provided to be copied el
<Story story={stories.Truncate} />

<Canvas>
<div style={{ width: '350px' }}>
<div style={{ width: '350px' }}>
<pds-copytext value="Copy all of this really long text that should be truncated in the UI, but will still be copied to the clipboard." truncate="true"></pds-copytext>
</div>
</Canvas>

0 comments on commit caa5f25

Please sign in to comment.