Skip to content

Commit 7eca82e

Browse files
authored
Merge pull request #88 from mother/svg-bg-fix
SVG Background Image Fixes
2 parents 31f105e + c586a28 commit 7eca82e

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

package-lock.json

+27-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Form/Checkbox/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import OIOContext from '../../OIOProvider/context'
77
import { OIOFormContext } from '..'
88
import checkboxIcon from './checkboxIcon.svg'
99

10+
const base64EncodedCheckboxIcon = window.btoa(checkboxIcon)
11+
1012
// ============================================================================
1113
// Component
1214
// ============================================================================
@@ -63,7 +65,7 @@ const Checkbox = React.forwardRef(({
6365
},
6466
'&:checked': {
6567
backgroundColor: `${inputHighlightColor}`,
66-
backgroundImage: `url('data:image/svg+xml;utf8,${checkboxIcon}')`,
68+
backgroundImage: `url('data:image/svg+xml;base64,${base64EncodedCheckboxIcon}')`,
6769
backgroundSize: '50%',
6870
borderColor: inputHighlightColor
6971
}

src/Form/Select/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import OIOContext from '../../OIOProvider/context'
77
import { OIOFormContext } from '..'
88
import selectArrowIcon from './selectArrowIcon.svg'
99

10+
const base64EncodedSelectArrowIcon = window.btoa(selectArrowIcon)
11+
1012
// ============================================================================
1113
// Size Specific Styles
1214
// ============================================================================
@@ -98,7 +100,7 @@ const Select = React.forwardRef(({
98100
backgroundColor: formContext.elementBackgroundColor,
99101
borderRadius: formContext.elementBorderRadius,
100102
backgroundRepeat: 'no-repeat',
101-
backgroundImage: `url('data:image/svg+xml;utf8,${selectArrowIcon}')`,
103+
backgroundImage: `url('data:image/svg+xml;base64,${base64EncodedSelectArrowIcon}')`,
102104
color: formContext.elementTextColor,
103105
outline: 'none',
104106
fontFamily: oioContext.fontFamily,

0 commit comments

Comments
 (0)