Skip to content

Commit 6c07224

Browse files
committed
update
1 parent c8425c7 commit 6c07224

File tree

42 files changed

+2855
-3946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2855
-3946
lines changed

000_DemoBase/package-lock.json

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

000_DemoBase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dannadori/demo-base",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {

000_DemoBase/src/components/Credit.tsx

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import React, { useMemo } from "react";
22

33
// @ts-ignore
4-
import homepage from "../../resources/logos/home.svg";
4+
import homepageSvg from "../../resources/logos/home.svg";
55
// @ts-ignore
6-
import github from "../../resources/logos/github.svg";
6+
import githubSvg from "../../resources/logos/github.svg";
77
// @ts-ignore
8-
import twitter from "../../resources/logos/twitter.svg";
8+
import twitterSvg from "../../resources/logos/twitter.svg";
99
// @ts-ignore
10-
import linkedin from "../../resources/logos/linkedin.svg";
11-
10+
import linkedinSvg from "../../resources/logos/linkedin.svg";
1211
// @ts-ignore
13-
import blog from "../../resources/logos/file-text.svg";
12+
import blogSvg from "../../resources/logos/file-text.svg";
1413

1514
export type CreditProps = {
16-
title?: string;
17-
homepage?: string;
18-
github?: string;
19-
twitter?: string;
20-
linkedin?: string;
21-
blog?: string;
15+
title: string;
16+
homepage: string;
17+
github: string;
18+
twitter: string;
19+
linkedin: string;
20+
blog: string;
2221
};
2322

2423
export type LinkIconProps = {
@@ -37,7 +36,7 @@ const LinkIcon = (props: LinkIconProps) => {
3736
);
3837
};
3938

40-
const creditProps: CreditProps = {
39+
const defaultProps: CreditProps = {
4140
title: "Created by w-okada. FLECT, Co., Ltd.",
4241
homepage: "https://www.flect.co.jp/",
4342
github: "https://github.com/w-okada/image-analyze-workers",
@@ -46,40 +45,47 @@ const creditProps: CreditProps = {
4645
blog: "https://medium.com/@dannadori",
4746
};
4847

49-
export const Credit = (props: CreditProps = creditProps) => {
48+
// using default parameters
49+
// https://stackoverflow.com/questions/47774695/react-functional-component-default-props-vs-default-parameters
50+
export const Credit = ({ title = defaultProps.title, homepage = defaultProps.homepage, github = defaultProps.github, twitter = defaultProps.twitter, linkedin = defaultProps.linkedin, blog = defaultProps.blog }) => {
5051
// const props = creditProps;
51-
const homepageIcon = props.homepage ? (
52+
53+
const homepageIcon = homepage ? (
5254
useMemo(() => {
53-
return <LinkIcon tooltip="homepage" icon={homepage} url={props.homepage!} />;
55+
return (
56+
<>
57+
<LinkIcon tooltip="homepage" icon={homepageSvg} url={homepage!} />
58+
</>
59+
);
5460
}, [])
5561
) : (
5662
<></>
5763
);
5864

59-
const githubIcon = props.github ? (
65+
const githubIcon = github ? (
6066
useMemo(() => {
61-
return <LinkIcon tooltip="github" icon={github} url={props.github!} />;
67+
return <LinkIcon tooltip="github" icon={githubSvg} url={github!} />;
6268
}, [])
6369
) : (
6470
<></>
6571
);
66-
const twitterIcon = props.twitter ? (
72+
const twitterIcon = twitter ? (
6773
useMemo(() => {
68-
return <LinkIcon tooltip="twitter" icon={twitter} url={props.twitter!} />;
74+
return <LinkIcon tooltip="twitter" icon={twitterSvg} url={twitter!} />;
6975
}, [])
7076
) : (
7177
<></>
7278
);
73-
const linkedInIcon = props.linkedin ? (
79+
const linkedInIcon = linkedin ? (
7480
useMemo(() => {
75-
return <LinkIcon tooltip="linkedin" icon={linkedin} url={props.linkedin!} />;
81+
return <LinkIcon tooltip="linkedin" icon={linkedinSvg} url={linkedin!} />;
7682
}, [])
7783
) : (
7884
<></>
7985
);
80-
const blogIcon = props.blog ? (
86+
const blogIcon = blog ? (
8187
useMemo(() => {
82-
return <LinkIcon tooltip="blog" icon={blog} url={props.blog!} />;
88+
return <LinkIcon tooltip="blog" icon={blogSvg} url={blog!} />;
8389
}, [])
8490
) : (
8591
<></>
@@ -89,7 +95,7 @@ export const Credit = (props: CreditProps = creditProps) => {
8995
<div style={{ display: "flex", flexDirection: "column", margin: "5px" }}>
9096
<div>
9197
<p className="text-slate-600" style={{ fontSize: "0.75rem" }}>
92-
{props.title}
98+
{title}
9399
</p>
94100
</div>
95101
<div style={{ display: "flex", margin: "5px" }}>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd ../000_DemoBase; npm run build ;cd - ;
2+
cp -r ../000_DemoBase/dist/* node_modules/\@dannadori/demo-base/dist/;
3+

0 commit comments

Comments
 (0)