Skip to content

Commit

Permalink
fix: colors of <Icon> not rendering correctly when it has no inline c…
Browse files Browse the repository at this point in the history
…olor prop set
  • Loading branch information
MildTomato committed Jan 6, 2021
1 parent 7e5574d commit fb6dde4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/Button/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
@apply outline-none ring;
}

.sbui-btn-primary:hover svg {
/* .sbui-btn-primary:hover svg {
@apply text-gray-500;
}
.sbui-btn-secondary:hover svg {
Expand All @@ -135,7 +135,7 @@
}
.sbui-btn-ghost:hover svg {
@apply bg-brand-300;
}
} */

.sbui-btn--with-icon {
/* @apply pl-10; */
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const withBlock = (args) => <Button {...args}>Button text</Button>
export const withOnlyIcon = (args) => <Button {...args}/>
export const withOnlyLoading = (args) => <Button {...args}/>

const icon = <Icon className={''} type={"Package"}/>
const icon = <Icon type={"Package"}/>

withIcon.args = {
type: 'primary',
Expand Down
4 changes: 1 addition & 3 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ interface Props {
type?: string,
color?: string,
strokeWidth?: number,
stroke?:string,
}

function Icon({
Expand All @@ -16,15 +15,14 @@ function Icon({
type,
color,
strokeWidth,
stroke,
...props
}: Props) {
// @ts-ignore
const FeatherIcon = Icons[type]

return (
<FeatherIcon
stroke={stroke ? stroke : color ? color : 'currentColor'}
color={color ? color : 'currentColor'}
className={`${className}`}
strokeWidth={strokeWidth}
size={size}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const textArea = (args :any) => <Input.TextArea {...args} />

export const textAreaWithLimit = (args :any) => <Input.TextArea {...args} />

const icon : any = <Icon stroke={'#666666'} className={''} type={"Package"}/>
const icon : any = <Icon type={"Package"}/>

Default.args = {
placeholder: 'Type text here ...',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const withDescription = (args: any) => (
)

const data = ['England', 'Wales', 'Scotland', 'Ireland']
const icon = <Icon stroke={'#666666'} type={'Book'} />
const icon = <Icon type={'Book'} />

Default.args = {
disabled: false,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/Layout/InputIconContainer.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.sbui-input-icon-container {
@apply absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none;
/* set the default color of the icon */
@apply text-gray-600;
@apply dark:text-white;
}

0 comments on commit fb6dde4

Please sign in to comment.