@primer/react
Version:
An implementation of GitHub's Primer Design System using React
60 lines (56 loc) • 1.16 kB
JavaScript
import { c } from 'react-compiler-runtime';
import React from 'react';
import styled from 'styled-components';
import sx from '../sx.js';
import { jsx } from 'react/jsx-runtime';
const Icon = /*#__PURE__*/React.forwardRef((props, ref) => {
const $ = c(7);
let IconComponent;
let rest;
if ($[0] !== props) {
({
icon: IconComponent,
...rest
} = props);
$[0] = props;
$[1] = IconComponent;
$[2] = rest;
} else {
IconComponent = $[1];
rest = $[2];
}
let t0;
if ($[3] !== IconComponent || $[4] !== ref || $[5] !== rest) {
t0 = /*#__PURE__*/jsx(IconComponent, {
...rest,
ref: ref
});
$[3] = IconComponent;
$[4] = ref;
$[5] = rest;
$[6] = t0;
} else {
t0 = $[6];
}
return t0;
});
/**
* @deprecated Use the icon component directly from `@primer/octicons-react` instead
*/
const Octicon = styled(Icon).withConfig({
shouldForwardProp(prop) {
return prop !== 'sx';
}
}).withConfig({
displayName: "Octicon",
componentId: "sc-9kayk9-0"
})(["", ""], ({
color,
sx: sxProp
}) => sx({
sx: {
color,
...sxProp
}
}));
export { Octicon as default };