Skip to content

Commit

Permalink
Normalize DOM structure of EuiFormControlLayoutCustomIcon.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Jun 4, 2018
1 parent c2c2568 commit 6d6e4f8
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,29 @@ exports[`EuiFormControlLayout props icon is rendered as a string 1`] = `
<div
class="euiFormControlLayoutIcons"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutCustomIcon"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
<span
class="euiFormControlLayoutCustomIcon"
>
<g
fill-rule="evenodd"
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
<g
fill-rule="evenodd"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
</span>
</div>
</div>
`;
Expand All @@ -89,26 +93,30 @@ exports[`EuiFormControlLayout props icon is rendered as an object 1`] = `
<div
class="euiFormControlLayoutIcons"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutCustomIcon customClass"
<span
class="euiFormControlLayoutCustomIcon customClass"
data-test-subj="myIcon"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<g
fill-rule="evenodd"
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
<g
fill-rule="evenodd"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
</span>
</div>
</div>
`;
Expand All @@ -120,25 +128,29 @@ exports[`EuiFormControlLayout props icon side left is rendered 1`] = `
<div
class="euiFormControlLayoutIcons"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutCustomIcon"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
<span
class="euiFormControlLayoutCustomIcon"
>
<g
fill-rule="evenodd"
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
<g
fill-rule="evenodd"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
</span>
</div>
</div>
`;
Expand All @@ -150,25 +162,29 @@ exports[`EuiFormControlLayout props icon side right is rendered 1`] = `
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutCustomIcon"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
<span
class="euiFormControlLayoutCustomIcon"
>
<g
fill-rule="evenodd"
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
<g
fill-rule="evenodd"
>
<path
d="M7.5 2.236L1.618 14h11.764L7.5 2.236zm.894-.447l5.882 11.764A1 1 0 0 1 13.382 15H1.618a1 1 0 0 1-.894-1.447L6.606 1.789a1 1 0 0 1 1.788 0z"
/>
<path
d="M7 6h1v5H7zM7 12h1v1H7z"
/>
</g>
</svg>
</span>
</div>
</div>
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,31 @@ export const EuiFormControlLayoutCustomIcon = ({
if (onClick) {
return (
<button
className={classes}
onClick={onClick}
className={classes}
ref={iconRef}
{...rest}
>
<EuiIcon
className="euiFormControlLayoutCustomIcon__clickableIcon"
aria-hidden="true"
type={type}
/>
</button>
);
}

return (
<EuiIcon
aria-hidden="true"
<span
className={classes}
type={type}
ref={iconRef}
{...rest}
/>
>
<EuiIcon
aria-hidden="true"
type={type}
/>
</span>
);
};

Expand Down

0 comments on commit 6d6e4f8

Please sign in to comment.