Skip to content

Commit

Permalink
Merge pull request #480 from hshoff/harry-group-ref
Browse files Browse the repository at this point in the history
[group] add innerRef prop. fixes #479
  • Loading branch information
hshoff authored Jul 16, 2019
2 parents c2c49d6 + 8af67c3 commit 230e6fc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/vx-demo/static/docs/vx-group.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ <h3 id="group-">&lt;Group /&gt;</h3>

<p><a id="#Group__children" name="Group__children" href="#Group__children">#</a> <em>Group</em>.<strong>children</strong>&lt;any&gt; </p>
<p><a id="#Group__className" name="Group__className" href="#Group__className">#</a> <em>Group</em>.<strong>className</strong>&lt;string&gt; </p>
<p><a id="#Group__innerRef" name="Group__innerRef" href="#Group__innerRef">#</a> <em>Group</em>.<strong>innerRef</strong>&lt;union(func|object)&gt; </p>
<p><a id="#Group__left" name="Group__left" href="#Group__left">#</a> <em>Group</em>.<strong>left</strong>&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table></p>
<p><a id="#Group__top" name="Group__top" href="#Group__top">#</a> <em>Group</em>.<strong>top</strong>&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table></p>
<p><a id="#Group__transform" name="Group__transform" href="#Group__transform">#</a> <em>Group</em>.<strong>transform</strong>&lt;string&gt; </p>
Expand Down
2 changes: 2 additions & 0 deletions packages/vx-group/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ npm install --save @vx/group

<a id="#Group__className" name="Group__className" href="#Group__className">#</a> *Group*.**className**&lt;string&gt;

<a id="#Group__innerRef" name="Group__innerRef" href="#Group__innerRef">#</a> *Group*.**innerRef**&lt;union(func|object)&gt;

<a id="#Group__left" name="Group__left" href="#Group__left">#</a> *Group*.**left**&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table>

<a id="#Group__top" name="Group__top" href="#Group__top">#</a> *Group*.**top**&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table>
Expand Down
2 changes: 2 additions & 0 deletions packages/vx-group/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

<a id="#Group__className" name="Group__className" href="#Group__className">#</a> *Group*.**className**&lt;string&gt;

<a id="#Group__innerRef" name="Group__innerRef" href="#Group__innerRef">#</a> *Group*.**innerRef**&lt;union(func|object)&gt;

<a id="#Group__left" name="Group__left" href="#Group__left">#</a> *Group*.**left**&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table>

<a id="#Group__top" name="Group__top" href="#Group__top">#</a> *Group*.**top**&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table>
Expand Down
2 changes: 2 additions & 0 deletions packages/vx-group/docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ npm install --save @vx/group

<a id="#Group__className" name="Group__className" href="#Group__className">#</a> *Group*.**className**&lt;string&gt;

<a id="#Group__innerRef" name="Group__innerRef" href="#Group__innerRef">#</a> *Group*.**innerRef**&lt;union(func|object)&gt;

<a id="#Group__left" name="Group__left" href="#Group__left">#</a> *Group*.**left**&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table>

<a id="#Group__top" name="Group__top" href="#Group__top">#</a> *Group*.**top**&lt;number&gt; <table><tr><td><strong>Default</strong></td><td>0</td></td></table>
Expand Down
14 changes: 12 additions & 2 deletions packages/vx-group/src/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ Group.propTypes = {
left: PropTypes.number,
transform: PropTypes.string,
className: PropTypes.string,
children: PropTypes.any
children: PropTypes.any,
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
};

export default function Group({ top = 0, left = 0, transform, className, children, ...restProps }) {
export default function Group({
top = 0,
left = 0,
transform,
className,
children,
innerRef,
...restProps
}) {
return (
<g
ref={innerRef}
className={cx('vx-group', className)}
transform={transform || `translate(${left}, ${top})`}
{...restProps}
Expand Down

0 comments on commit 230e6fc

Please sign in to comment.