Skip to content

Commit 81c2ccc

Browse files
authored
Docs - Colors token box to copy token (#3727)
* Refactor onTokenPress to use token for clipboard and update message format * Bump docuilib version
1 parent be79eab commit 81c2ccc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

docuilib/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "uilib-docs",
3-
"version": "3.28.1",
3+
"version": "3.29.0",
44
"main": "./src/index.ts",
55
"scripts": {
66
"docusaurus": "docusaurus",

docuilib/src/components/ColorsSection.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ export function ColorsTable() {
7575
}
7676
}));
7777

78-
const onTokenPress = value => {
79-
Clipboard.setString(value);
80-
const systemColorName = Colors.getSystemColorByHex(value);
81-
const message = `Copied ${value} to clipboard\n System color: ${systemColorName}`;
78+
const onTokenPress = ({token, value}) => {
79+
Clipboard.setString(token);
80+
const message = `Copied ${token} to clipboard\nHex: ${value}`;
8281
setMessage(message);
8382
toggleToastVisibility();
8483
};
@@ -92,7 +91,7 @@ export function ColorsTable() {
9291
};
9392

9493
const TokenBox = ({token, index, mode, onPress}) => (
95-
<TouchableOpacity onPress={() => onPress(Colors.getColor(token, mode))} flex marginV-s1>
94+
<TouchableOpacity onPress={() => onPress({token, value: Colors.getColor(token, mode)})} flex marginV-s1>
9695
<View key={`${token}-${index}-${mode}-container`} center row marginB-3>
9796
<View
9897
key={`${token}-${index}-${mode}`}

0 commit comments

Comments
 (0)