Skip to content

Commit

Permalink
fix: avoid inline style, provide default size (#55)
Browse files Browse the repository at this point in the history
* fix: avoid inline style, provide default size

* docs: readme

* chore: yarn up `@icona/*`

* 0.5.0

* chore: bump & build

---------

Co-authored-by: junghyeonsu <[email protected]>
  • Loading branch information
malangcat and junghyeonsu authored Dec 2, 2023
1 parent dab1a21 commit 41c9c47
Show file tree
Hide file tree
Showing 1,162 changed files with 9,826 additions and 15,021 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { IconName1, IconName2 } from "@seed-design/icon";
```jsx
import { IconName1, IconName2 } from "@seed-design/icon";

// SVG props 사용 가능
<IconName1 size={20} />;
```

Expand Down
1 change: 0 additions & 1 deletion build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const run = ({ entryPoints }) => {
outdir: "lib",
target: "es2019",
sourcemap: true,
minify: true,
};

Promise.all([
Expand Down
33 changes: 11 additions & 22 deletions icona.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,15 @@ generate({
template: (variables, { tpl }) => {
return tpl`
${variables.imports};
interface Props {
size: number | string;
className?: string;
}
const SVG = (${variables.props}) => (
const ${variables.componentName} = (
{ size = 24, ...props }: SVGProps<SVGSVGElement> & { size?: number | string },
ref: Ref<SVGSVGElement>
) => (
${variables.jsx}
);
const ${variables.componentName} = (
{ size, className }: Props,
ref: React.ForwardedRef<HTMLSpanElement>,
) => {
return (
<span
ref={ref}
className={className}
style={{ display: "inline-flex", width: size, height: size }}
>
<SVG />
</span>
)
};
export default React.forwardRef(${variables.componentName});
${variables.exports}
`;
},
jsxRuntime: "classic",
Expand Down Expand Up @@ -135,12 +119,17 @@ generate({
},
typescript: true,
dimensions: false,
ref: true,
svgProps: {
width: "{size}",
height: "{size}",
},
},
},
png: {
active: true,
genMode: "recreate",
path: "png",
}
},
},
});
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@seed-design/icon",
"version": "0.4.0",
"version": "0.5.0",
"repository": "https://github.com/daangn/seed-icon.git",
"author": "junghyeonsu <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -44,9 +44,9 @@
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@icona/generator": "^0.2.1",
"@icona/types": "^0.2.1",
"@icona/utils": "^0.2.1",
"@icona/generator": "^0.2.2",
"@icona/types": "^0.2.2",
"@icona/utils": "^0.2.2",
"@svgr/plugin-jsx": "^8.0.1",
"@svgr/plugin-prettier": "^8.0.1",
"@svgr/plugin-svgo": "^8.0.1",
Expand Down
41 changes: 16 additions & 25 deletions react/IconAddCircleFill.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import * as React from 'react';
import type { SVGProps } from 'react';
interface Props {
size: number | string;
className?: string;
}
const SVG = (props: SVGProps<SVGSVGElement>) => (
import { Ref, forwardRef } from 'react';
const IconAddCircleFill = (
{
size = 24,
...props
}: SVGProps<SVGSVGElement> & {
size?: number | string,
},
ref: Ref<SVGSVGElement>
) => (
<svg
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
data-seed-icon="true"
data-seed-icon-version="0.3.15"
data-seed-icon-version="0.5.0"
width={size}
height={size}
ref={ref}
{...props}
>
<g>
Expand All @@ -23,22 +31,5 @@ const SVG = (props: SVGProps<SVGSVGElement>) => (
</g>
</svg>
);
const IconAddCircleFill = (
{ size, className }: Props,
ref: React.ForwardedRef<HTMLSpanElement>
) => {
return (
<span
ref={ref}
className={className}
style={{
display: 'inline-flex',
width: size,
height: size,
}}
>
<SVG />
</span>
);
};
export default React.forwardRef(IconAddCircleFill);
const ForwardRef = forwardRef(IconAddCircleFill);
export default ForwardRef;
41 changes: 16 additions & 25 deletions react/IconAddCircleRegular.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import * as React from 'react';
import type { SVGProps } from 'react';
interface Props {
size: number | string;
className?: string;
}
const SVG = (props: SVGProps<SVGSVGElement>) => (
import { Ref, forwardRef } from 'react';
const IconAddCircleRegular = (
{
size = 24,
...props
}: SVGProps<SVGSVGElement> & {
size?: number | string,
},
ref: Ref<SVGSVGElement>
) => (
<svg
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
data-seed-icon="true"
data-seed-icon-version="0.3.15"
data-seed-icon-version="0.5.0"
width={size}
height={size}
ref={ref}
{...props}
>
<g>
Expand All @@ -29,22 +37,5 @@ const SVG = (props: SVGProps<SVGSVGElement>) => (
</g>
</svg>
);
const IconAddCircleRegular = (
{ size, className }: Props,
ref: React.ForwardedRef<HTMLSpanElement>
) => {
return (
<span
ref={ref}
className={className}
style={{
display: 'inline-flex',
width: size,
height: size,
}}
>
<SVG />
</span>
);
};
export default React.forwardRef(IconAddCircleRegular);
const ForwardRef = forwardRef(IconAddCircleRegular);
export default ForwardRef;
41 changes: 16 additions & 25 deletions react/IconAddCircleThin.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import * as React from 'react';
import type { SVGProps } from 'react';
interface Props {
size: number | string;
className?: string;
}
const SVG = (props: SVGProps<SVGSVGElement>) => (
import { Ref, forwardRef } from 'react';
const IconAddCircleThin = (
{
size = 24,
...props
}: SVGProps<SVGSVGElement> & {
size?: number | string,
},
ref: Ref<SVGSVGElement>
) => (
<svg
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
data-seed-icon="true"
data-seed-icon-version="0.3.15"
data-seed-icon-version="0.5.0"
width={size}
height={size}
ref={ref}
{...props}
>
<g>
Expand All @@ -29,22 +37,5 @@ const SVG = (props: SVGProps<SVGSVGElement>) => (
</g>
</svg>
);
const IconAddCircleThin = (
{ size, className }: Props,
ref: React.ForwardedRef<HTMLSpanElement>
) => {
return (
<span
ref={ref}
className={className}
style={{
display: 'inline-flex',
width: size,
height: size,
}}
>
<SVG />
</span>
);
};
export default React.forwardRef(IconAddCircleThin);
const ForwardRef = forwardRef(IconAddCircleThin);
export default ForwardRef;
41 changes: 16 additions & 25 deletions react/IconAddFill.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import * as React from 'react';
import type { SVGProps } from 'react';
interface Props {
size: number | string;
className?: string;
}
const SVG = (props: SVGProps<SVGSVGElement>) => (
import { Ref, forwardRef } from 'react';
const IconAddFill = (
{
size = 24,
...props
}: SVGProps<SVGSVGElement> & {
size?: number | string,
},
ref: Ref<SVGSVGElement>
) => (
<svg
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
data-seed-icon="true"
data-seed-icon-version="0.3.15"
data-seed-icon-version="0.5.0"
width={size}
height={size}
ref={ref}
{...props}
>
<g>
Expand All @@ -21,22 +29,5 @@ const SVG = (props: SVGProps<SVGSVGElement>) => (
</g>
</svg>
);
const IconAddFill = (
{ size, className }: Props,
ref: React.ForwardedRef<HTMLSpanElement>
) => {
return (
<span
ref={ref}
className={className}
style={{
display: 'inline-flex',
width: size,
height: size,
}}
>
<SVG />
</span>
);
};
export default React.forwardRef(IconAddFill);
const ForwardRef = forwardRef(IconAddFill);
export default ForwardRef;
41 changes: 16 additions & 25 deletions react/IconAddRegular.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import * as React from 'react';
import type { SVGProps } from 'react';
interface Props {
size: number | string;
className?: string;
}
const SVG = (props: SVGProps<SVGSVGElement>) => (
import { Ref, forwardRef } from 'react';
const IconAddRegular = (
{
size = 24,
...props
}: SVGProps<SVGSVGElement> & {
size?: number | string,
},
ref: Ref<SVGSVGElement>
) => (
<svg
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
data-seed-icon="true"
data-seed-icon-version="0.3.15"
data-seed-icon-version="0.5.0"
width={size}
height={size}
ref={ref}
{...props}
>
<g>
Expand All @@ -23,22 +31,5 @@ const SVG = (props: SVGProps<SVGSVGElement>) => (
</g>
</svg>
);
const IconAddRegular = (
{ size, className }: Props,
ref: React.ForwardedRef<HTMLSpanElement>
) => {
return (
<span
ref={ref}
className={className}
style={{
display: 'inline-flex',
width: size,
height: size,
}}
>
<SVG />
</span>
);
};
export default React.forwardRef(IconAddRegular);
const ForwardRef = forwardRef(IconAddRegular);
export default ForwardRef;
Loading

0 comments on commit 41c9c47

Please sign in to comment.