Skip to content

Commit a37e0ab

Browse files
authored
chore(docs): Fix color type link (#4588)
1 parent 4b4e31a commit a37e0ab

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

shared/components/StylingHooksTable.jsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ const getPropTypeData = (name, varName) => {
2525
};
2626
};
2727

28+
const formatType = type => {
29+
let formattedType = type.toLowerCase();
30+
if (formattedType === 'color') {
31+
formattedType += '_value'; // MDN adds _value to color data type page, this discrepancy is unique
32+
}
33+
return formattedType;
34+
};
35+
2836
class StylingHooksTable extends Component {
2937
render() {
3038
const { name, type } = this.props;
@@ -109,14 +117,17 @@ class StylingHooksTable extends Component {
109117
</div>
110118
</td>
111119
<td>
112-
{varData.types.map((type, x) => (
113-
<a
114-
key={`${category}-${i}-${ii}-${x}`}
115-
href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${type.toLowerCase()}`}
116-
>
117-
{type}
118-
</a>
119-
))}
120+
{varData.types.map((type, x) => {
121+
const formattedType = formatType(type);
122+
return (
123+
<a
124+
key={`${category}-${i}-${ii}-${x}`}
125+
href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${formattedType}`}
126+
>
127+
{type}
128+
</a>
129+
);
130+
})}
120131
</td>
121132
<td>{varData.value}</td>
122133
</tr>

0 commit comments

Comments
 (0)