From fe654ea82832e6f7ca5514e95cf536fd16db5928 Mon Sep 17 00:00:00 2001 From: Michele Azzolari Date: Wed, 29 Apr 2020 13:05:54 +0200 Subject: [PATCH] React: fill is not a style property, it's a svg attribute. Added a default to currentColor but it's possibile to overwrite it via 'fill' prop Updated react doc Updates react test --- docs/content/packages/react.mdx | 18 ++++++++++++++++++ .../__tests__/__snapshots__/octicon.js.snap | 2 +- lib/octicons_react/src/__tests__/octicon.js | 4 ++++ lib/octicons_react/src/index.d.ts | 3 ++- lib/octicons_react/src/index.js | 7 +++++-- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/content/packages/react.mdx b/docs/content/packages/react.mdx index 26887d13b..d55e442e9 100644 --- a/docs/content/packages/react.mdx +++ b/docs/content/packages/react.mdx @@ -154,6 +154,24 @@ export default () => ( ``` +### Fill +The `fill` prop takes a string value that can be used to color the icon. +Default value is `currentColor` which means it inherits parent's text color. + +```js +// Example usage +import Octicon, {LogoGithub} from '@primer/octicons-react' + +export default () => ( +

+ + + +

+) +``` + + ## Custom icons Each of our icon components is really just a function that renders its SVG ``. To accommodate icons varying aspect ratios, the `Octicon` component diff --git a/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap b/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap index d2f4ec7d8..047e720c4 100644 --- a/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap +++ b/lib/octicons_react/src/__tests__/__snapshots__/octicon.js.snap @@ -4,12 +4,12 @@ exports[` outputs 1`] = `