lint fixes for react-components
This commit is contained in:
parent
f27aacc152
commit
3503d97fae
18 changed files with 38 additions and 9 deletions
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
|
||||
export const Circle = ({ point }) =>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
|
||||
const style = ` style="fill: none; stroke: currentColor;" `
|
||||
|
@ -17,6 +18,9 @@ export const Defs = (props) => {
|
|||
if (typeof part.points.gridAnchor !== 'undefined') anchor = part.points.gridAnchor
|
||||
else if (typeof part.points.anchor !== 'undefined') anchor = part.points.anchor
|
||||
|
||||
if (isNaN(anchor.x)) anchor.x = 0
|
||||
if (isNaN(anchor.y)) anchor.y = 0
|
||||
|
||||
defs += `<pattern id="grid-${stack}" key="grid-${stack}" xlink:href="#grid" x="${anchor.x}" y="${anchor.y}" />`
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
|
||||
export const Grid = ({ stack, stackName }) => (
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React, { forwardRef } from 'react'
|
||||
|
||||
export const Group = forwardRef((props, ref) => (
|
||||
|
@ -5,3 +6,5 @@ export const Group = forwardRef((props, ref) => (
|
|||
{props.children}
|
||||
</g>
|
||||
))
|
||||
|
||||
Group.displayName = 'Group'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React, { forwardRef } from 'react'
|
||||
// Components that can be swizzled
|
||||
import { Svg as DefaultSvg } from './svg.mjs'
|
||||
|
@ -84,3 +85,5 @@ export const Pattern = forwardRef(
|
|||
)
|
||||
}
|
||||
)
|
||||
|
||||
Pattern.displayName = 'Pattern'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React, { forwardRef } from 'react'
|
||||
import { getId, getProps } from './utils.mjs'
|
||||
|
||||
|
@ -38,6 +39,8 @@ export const PartInner = forwardRef(
|
|||
}
|
||||
)
|
||||
|
||||
PartInner.displayName = 'PartInner'
|
||||
|
||||
export const Part = ({ stackName, partName, part, settings, components, t }) => {
|
||||
const { Group } = components
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
import { getId, getProps } from './utils.mjs'
|
||||
|
||||
export const Path = ({ stackName, pathName, path, partName, part, settings, components, t }) => {
|
||||
export const Path = ({ stackName, pathName, path, partName, settings, components, t }) => {
|
||||
// Don't render hidden paths
|
||||
if (path.hidden) return null
|
||||
|
||||
// Get potentially swizzled components
|
||||
const { TextOnPath } = components
|
||||
|
||||
const output = []
|
||||
const pathId = getId({ settings, stackName, partName, pathName })
|
||||
|
||||
return (
|
||||
|
@ -19,6 +19,4 @@ export const Path = ({ stackName, pathName, path, partName, part, settings, comp
|
|||
) : null}
|
||||
</>
|
||||
)
|
||||
|
||||
return output
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
import { withinPartBounds } from './utils.mjs'
|
||||
|
||||
export const Point = ({ stackName, partName, pointName, part, point, settings, components, t }) => {
|
||||
export const Point = ({ stackName, partName, pointName, part, point, components, t }) => {
|
||||
// Don't include points outside the part bounding box
|
||||
if (!withinPartBounds(point, part)) return null
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
import { getProps } from './utils.mjs'
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
import { getProps } from './utils.mjs'
|
||||
|
||||
|
@ -8,7 +9,7 @@ export const Stack = ({ stackName, stack, settings, components, t }) => {
|
|||
<Group {...getProps(stack)}>
|
||||
{settings[0].paperless ? <Grid {...{ stack, stackName }} /> : null}
|
||||
{[...stack.parts].map((part, key) => (
|
||||
<Part {...{ settings, components, t, part, stackName, key }} />
|
||||
<Part {...{ settings, components, t, part, stackName }} key={key} />
|
||||
))}
|
||||
</Group>
|
||||
)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
import { forwardRef } from 'react'
|
||||
|
||||
|
@ -39,3 +40,5 @@ export const Svg = forwardRef(
|
|||
)
|
||||
}
|
||||
)
|
||||
|
||||
Svg.displayName = 'Svg'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
import { translateStrings } from './utils.mjs'
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
import React from 'react'
|
||||
|
||||
export const getProps = (obj) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue