Skip to content

Commit 0c66d12

Browse files
committed
Merge branch 'main' of github.com-lglab:LGLabGreg/react-qr-code
2 parents be2da20 + 8792616 commit 0c66d12

5 files changed

Lines changed: 72 additions & 60 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@lglab/react-qr-code': patch
3+
---
4+
5+
Allow transparent background

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "git",
66
"url": "https://github.com/LGLabGreg/react-qr-code.git"
77
},
8-
"packageManager": "[email protected].0",
8+
"packageManager": "[email protected].1",
99
"type": "module",
1010
"scripts": {
1111
"dev": "pnpm concurrently --names packages,apps \"pnpm watch:packages\" \"pnpm watch:apps\"",
@@ -28,7 +28,7 @@
2828
},
2929
"devDependencies": {
3030
"@changesets/cli": "^2.27.12",
31-
"@eslint/js": "^9.19.0",
31+
"@eslint/js": "^9.20.0",
3232
"@testing-library/jest-dom": "^6.6.3",
3333
"@testing-library/react": "^16.2.0",
3434
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
@@ -37,7 +37,7 @@
3737
"@vitejs/plugin-react": "^4.3.4",
3838
"@vitest/coverage-v8": "3.0.5",
3939
"concurrently": "^9.1.2",
40-
"eslint": "^9.19.0",
40+
"eslint": "^9.20.0",
4141
"eslint-plugin-react": "^7.37.4",
4242
"eslint-plugin-react-hooks": "^5.1.0",
4343
"eslint-plugin-react-refresh": "^0.4.18",

packages/react-qr-code/src/components/background.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BG_GRADIENT_ID, DEFAULT_BGCOLOR } from '../constants'
1+
import { BG_GRADIENT_ID } from '../constants'
22
import type { BackgroundSettings } from '../types/lib'
33
import { calculateGradientVectors } from '../utils/svg'
44

@@ -13,13 +13,7 @@ const testProps = {
1313

1414
export const Background = ({ background, numCells }: BackgroundProps) => {
1515
if (!background) {
16-
return (
17-
<path
18-
fill={DEFAULT_BGCOLOR}
19-
d={`M0,0 h${numCells}v${numCells}H0z`}
20-
{...testProps}
21-
/>
22-
)
16+
return null
2317
}
2418

2519
if (typeof background === 'string') {

packages/react-qr-code/src/react-qr-code.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { describe, expect, it, vi } from 'vitest'
44

55
import {
66
BG_GRADIENT_ID,
7-
DEFAULT_BGCOLOR,
87
DEFAULT_MARGIN_SIZE,
98
DEFAULT_SIZE,
109
GRADIENT_ID,
@@ -121,11 +120,11 @@ describe('ReactQRCode', () => {
121120
})
122121

123122
describe('Background', () => {
124-
it('renders with default background color', () => {
123+
it('renders without background if not provided', () => {
125124
render(<ReactQRCode value='test' />)
126125

127-
const background = screen.getByTestId('background')
128-
expect(background).toHaveAttribute('fill', DEFAULT_BGCOLOR)
126+
const background = screen.queryByTestId('background')
127+
expect(background).not.toBeInTheDocument()
129128
})
130129

131130
it('renders with custom background color', () => {

pnpm-lock.yaml

Lines changed: 59 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)