Skip to content

Commit 32f6471

Browse files
committed
feat: move to emotion
- for now, goal is to move to css modules or another solution, but not just yet
1 parent 862ed96 commit 32f6471

File tree

5 files changed

+320
-159
lines changed

5 files changed

+320
-159
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A React component that provides a customizable Progressive Web App (PWA) prompt
2020
- 📃 Customize prompt content based on PWA availability and full-screen mode.
2121
- ⚡️ Efficient: Minimal overhead for non-iOS devices, optimizing each page load.
2222
- 🌕 Dark mode support: Adapts to iOS 13 and 14 settings.
23-
- 🎨 Supports custom styling with `styled-components`
23+
- 🎨 Supports custom styling with `emotion`
2424

2525
## Usage
2626

@@ -33,7 +33,8 @@ npm i react-ios-pwa-prompt-ts
3333
2. Add peer dependencies if not already included in your application:
3434

3535
```
36-
npm i react styled-components
36+
npm i @emotion/react && \
37+
npm i @emotion/styled
3738
```
3839

3940
3. Import into your project:

eslint.config.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import importPlugin from 'eslint-plugin-import';
44
import jsxA11Y from 'eslint-plugin-jsx-a11y';
55
import pluginReactHooks from 'eslint-plugin-react-hooks';
66
import reactRefresh from 'eslint-plugin-react-refresh';
7-
import styledA11y from 'eslint-plugin-styled-components-a11y';
87
import testingLibrary from 'eslint-plugin-testing-library';
98
import globals from 'globals';
109
import tseslint from 'typescript-eslint';
@@ -14,7 +13,6 @@ export default [
1413
js.configs.recommended,
1514
importPlugin.flatConfigs.recommended,
1615
jsxA11Y.flatConfigs.recommended,
17-
styledA11y.flatConfigs.recommended,
1816
testingLibrary.configs['flat/dom'],
1917
...tseslint.configs.recommended,
2018
...storybook.configs['flat/recommended'],

lib/components/styled.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import styled from '@emotion/styled';
12
import { FaRegSquarePlus } from 'react-icons/fa6';
23
import { IoShareOutline } from 'react-icons/io5';
3-
import { styled } from 'styled-components';
4+
5+
import type { IconBaseProps } from 'react-icons';
46

57
type PromptCopyProps = {
68
$bold?: boolean;
@@ -11,6 +13,10 @@ type VisibleElementProps = {
1113
$transitionDuration?: number;
1214
};
1315

16+
const IoShareOutlineViewBox = (props: IconBaseProps) => (
17+
<IoShareOutline viewBox="55 0 512 512" {...props} />
18+
);
19+
1420
export const PromptOverlay = styled.div<VisibleElementProps>`
1521
background-color: rgba(10, 10, 10, 0.5);
1622
display: ${({ $isVisible }) => ($isVisible ? 'block' : 'none')};
@@ -145,9 +151,7 @@ export const PromptDescription = styled.div`
145151
}
146152
`;
147153

148-
export const PromptShareIcon = styled(IoShareOutline).attrs({
149-
viewBox: '55 0 512 512',
150-
})`
154+
export const PromptShareIcon = styled(IoShareOutlineViewBox)`
151155
color: rgba(0, 85, 179, 1);
152156
height: 44px;
153157
margin-right: 15px;

0 commit comments

Comments
 (0)