Commit 231e620f by Łukasz Siatka Committed by Lukas Siatka

Explore: updates responsive button to forward ref

parent c9645a96
import React from 'react'; import React, { forwardRef } from 'react';
export enum IconSide { export enum IconSide {
left = 'left', left = 'left',
...@@ -19,7 +19,7 @@ function formatBtnTitle(title: string, iconSide?: string): string { ...@@ -19,7 +19,7 @@ function formatBtnTitle(title: string, iconSide?: string): string {
return iconSide === IconSide.left ? '\xA0' + title : iconSide === IconSide.right ? title + '\xA0' : title; return iconSide === IconSide.left ? '\xA0' + title : iconSide === IconSide.right ? title + '\xA0' : title;
} }
export const ResponsiveButton = (props: Props) => { export const ResponsiveButton = forwardRef<HTMLButtonElement, Props>((props, ref) => {
const defaultProps = { const defaultProps = {
iconSide: IconSide.left, iconSide: IconSide.left,
}; };
...@@ -37,4 +37,4 @@ export const ResponsiveButton = (props: Props) => { ...@@ -37,4 +37,4 @@ export const ResponsiveButton = (props: Props) => {
{iconClassName && iconSide === IconSide.right ? <i className={`${iconClassName}`} /> : null} {iconClassName && iconSide === IconSide.right ? <i className={`${iconClassName}`} /> : null}
</button> </button>
); );
}; });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment