Skip to content

Commit

Permalink
Merge pull request #88 from mother/svg-bg-fix
Browse files Browse the repository at this point in the history
SVG Background Image Fixes
  • Loading branch information
asabhaney authored May 18, 2021
2 parents 31f105e + c586a28 commit 7eca82e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/Form/Checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import OIOContext from '../../OIOProvider/context'
import { OIOFormContext } from '..'
import checkboxIcon from './checkboxIcon.svg'

const base64EncodedCheckboxIcon = window.btoa(checkboxIcon)

// ============================================================================
// Component
// ============================================================================
Expand Down Expand Up @@ -63,7 +65,7 @@ const Checkbox = React.forwardRef(({
},
'&:checked': {
backgroundColor: `${inputHighlightColor}`,
backgroundImage: `url('data:image/svg+xml;utf8,${checkboxIcon}')`,
backgroundImage: `url('data:image/svg+xml;base64,${base64EncodedCheckboxIcon}')`,
backgroundSize: '50%',
borderColor: inputHighlightColor
}
Expand Down
4 changes: 3 additions & 1 deletion src/Form/Select/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import OIOContext from '../../OIOProvider/context'
import { OIOFormContext } from '..'
import selectArrowIcon from './selectArrowIcon.svg'

const base64EncodedSelectArrowIcon = window.btoa(selectArrowIcon)

// ============================================================================
// Size Specific Styles
// ============================================================================
Expand Down Expand Up @@ -98,7 +100,7 @@ const Select = React.forwardRef(({
backgroundColor: formContext.elementBackgroundColor,
borderRadius: formContext.elementBorderRadius,
backgroundRepeat: 'no-repeat',
backgroundImage: `url('data:image/svg+xml;utf8,${selectArrowIcon}')`,
backgroundImage: `url('data:image/svg+xml;base64,${base64EncodedSelectArrowIcon}')`,
color: formContext.elementTextColor,
outline: 'none',
fontFamily: oioContext.fontFamily,
Expand Down

0 comments on commit 7eca82e

Please sign in to comment.