File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
components/doc/code-group Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,16 @@ export default class DocCodeGroup extends Component<DocCodeGroupSignature> {
9494 return label ;
9595 }
9696
97+ get copyButtonClassNames() {
98+ const classNames = [' doc-code-group__copy-button' ];
99+ if (this .copyStatus === ' success' ) {
100+ classNames .push (' doc-code-group__copy-button--status-success' );
101+ } else if (this .copyStatus === ' error' ) {
102+ classNames .push (' doc-code-group__copy-button--status-error' );
103+ }
104+ return classNames .join (' ' );
105+ }
106+
97107 handleGtsExpandClick = () => {
98108 this .isExpanded = ! this .isExpanded ;
99109 this .expandIconName = this .isExpanded ? ' unfold-close' : ' unfold-open' ;
@@ -162,7 +172,7 @@ export default class DocCodeGroup extends Component<DocCodeGroupSignature> {
162172 <button
163173 type =" button"
164174 aria-label ={{this .copyButtonLabel }}
165- class =" doc-code-group__copy-button "
175+ class ={{ this .copyButtonClassNames }}
166176 {{docClipboard
167177 text =this . currentViewSnippet
168178 onSuccess =this . onSuccess
Original file line number Diff line number Diff line change 6767 border-radius : 4px ;
6868 cursor : pointer ;
6969
70-
71- & :hover {
70+ & :hover {
7271 background-color : var (--doc-color-gray-600 );
7372 }
73+
74+ & .doc-code-group__copy-button--status-success {
75+ color : var (--doc-color-feedback-success-100 );
76+ background-color : var (--doc-color-feedback-success-300 );
77+ }
78+
79+ & .doc-code-group__copy-button--status-error {
80+ color : var (--doc-color-feedback-critical-100 );
81+ background-color : var (--doc-color-feedback-critical-300 );
82+ }
7483 }
7584 }
7685}
You can’t perform that action at this time.
0 commit comments