Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

issue(a11y): Add support for title and description nodes via props #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions index.js
@@ -1,10 +1,14 @@
import { default as React } from 'react'
import PropTypes from 'prop-types'
const IconBase = ({ children, color, size, style, width, height, ...props }, { reactIconBase = {} }) => {
const IconBase = ({ children, color, size, style, width, height, title, description, ...props }, { reactIconBase = {} }) => {
const computedSize = size || reactIconBase.size || '1em'
const titleEl = title && <title key="t" children={title} />;
const descEl = description && <description key="d" children={description} />;
const childrenArr = React.Children.map(children, c => c) || [];
const childrenPlus = [titleEl, descEl, ...childrenArr];
return (
<svg
children={children}
children={childrenPlus}
fill='currentColor'
preserveAspectRatio='xMidYMid meet'
height={height || computedSize}
Expand Down