Skip to content

Commit 0253d1b

Browse files
authored
Merge pull request #441 from wweverma1/feature/add-kofi-button
issue #424: add Ko-fi donation option
2 parents c7fc859 + bbf6cf6 commit 0253d1b

File tree

3 files changed

+50
-21
lines changed

3 files changed

+50
-21
lines changed

src/components/markdown.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ const DisplaySupport = props => {
266266
{props.support.buyMeACoffee &&
267267
`<a href="https://www.buymeacoffee.com/${props.support.buyMeACoffee}">
268268
<img align="left" src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="50" width="210" alt="${props.support.buyMeACoffee}" /></a>`}
269+
{props.support.buyMeAKofi &&
270+
`<a href="https://ko-fi.com/${props.support.buyMeAKofi}">
271+
<img align="left" src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height="50" width="210" alt="${props.support.buyMeAKofi}" /></a>`}
269272
{`</p><br><br>`}
270273
<br />
271274
<br />
@@ -277,7 +280,7 @@ const DisplaySupport = props => {
277280
const Markdown = props => {
278281
const icon_base_url =
279282
"https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/";
280-
283+
281284
return (
282285
<div id="markdown-content" className="break-words">
283286
<>
@@ -405,7 +408,7 @@ const Markdown = props => {
405408
</>
406409
<>
407410
<DisplaySocial
408-
base="https://linkedin.com/in"
411+
base="https://linkedin.com/in"
409412
icon={icon_base_url + "linked-in-alt.svg"}
410413
username={props.social.linkedin}
411414
/>

src/components/markdownPreview.js

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const DisplaySocial = props => {
122122

123123
export const SocialPreview = props => {
124124
let viewSocial = false
125-
const icon_base_url =
125+
const icon_base_url =
126126
"https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/";
127127
Object.keys(props.social).forEach(key => {
128128
if (props.social[key] && key != "github") viewSocial = true
@@ -153,7 +153,7 @@ export const SocialPreview = props => {
153153
</>
154154
<>
155155
<DisplaySocial
156-
base="https://linkedin.com/in"
156+
base="https://linkedin.com/in"
157157
icon={icon_base_url + "linked-in-alt.svg"}
158158
username={props.social.linkedin}
159159
/>
@@ -413,24 +413,36 @@ export const SupportPreview = props => {
413413
viewSupport = true
414414
}
415415
})
416-
return (
417-
<div className="mb-4">
416+
return props.support.buyMeACoffee || props.support.buyMeAKofi ? (
417+
<div className="flex flex-wrap justify-start items-center">
418418
<SectionTitle label="Support:" visible={viewSupport} />
419419
{props.support.buyMeACoffee && (
420-
<div style={{ width: "210px" }}>
421-
<a
422-
href={`https://www.buymeacoffee.com/` + props.support.buyMeACoffee}
423-
target="_blank"
424-
>
425-
<img
426-
src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"
427-
alt="Buy Me A Coffee"
428-
className="w-36 h-8 sm:w-52 sm:h-12"
429-
/>
430-
</a>
431-
</div>
420+
<a
421+
href={`https://www.buymeacoffee.com/` + props.support.buyMeACoffee}
422+
target="_blank"
423+
>
424+
<img
425+
src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"
426+
alt="Buy Me A Coffee"
427+
className="mb-4 mr-4 w-36 h-8 sm:w-52 sm:h-12"
428+
/>
429+
</a>
430+
)}
431+
{props.support.buyMeAKofi && (
432+
<a
433+
href={`https://ko-fi.com/` + props.support.buyMeAKofi}
434+
target="_blank"
435+
>
436+
<img
437+
src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3"
438+
alt="Buy Me A Ko-fi"
439+
className="mb-4 mr-4 w-36 h-8 sm:w-52 sm:h-12"
440+
/>
441+
</a>
432442
)}
433443
</div>
444+
) : (
445+
""
434446
)
435447
}
436448

src/components/support.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,34 @@ const Support = props => {
77
Support
88
</div>
99
<div className="flex flex-wrap justify-start items-center">
10-
<div className="w-2/5 flex justify-between items-center text-xxs sm:text-lg py-4 pr-2 sm:pr-0">
10+
<div className="w-1/2 flex justify-start items-center text-xxs sm:text-lg py-4 pr-2 sm:pr-0">
1111
<img
1212
src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"
13-
className="w-36 h-8 sm:w-52 sm:h-12"
13+
className="w-36 h-8 sm:w-52 sm:h-12 mr-1 sm:mr-4"
1414
alt="buymeacoffee"
1515
/>
1616
<input
1717
id="buy-me-a-coffee"
1818
placeholder="buymeacoffee username"
19-
className="outline-none placeholder-gray-700 w-32 sm:w-1/2 border-t-0 border-l-0 border-r-0 border solid border-gray-900 py-1 px-1 sm:px-2 ml-2 sm:ml-0 focus:border-blue-700"
19+
className="outline-none placeholder-gray-700 w-32 sm:w-1/2 border-t-0 border-l-0 border-r-0 border solid border-gray-900 py-1 px-1 focus:border-blue-700"
2020
value={props.support.buyMeACoffee || ""}
2121
onChange={event => props.handleSupportChange("buyMeACoffee", event)}
2222
/>
2323
</div>
24+
<div className="w-1/2 flex justify-start items-center text-xxs sm:text-lg py-4 pr-2 sm:pr-0">
25+
<img
26+
src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3"
27+
className="w-36 h-8 sm:w-52 sm:h-12 mr-1 sm:mr-4"
28+
alt="buymeakofi"
29+
/>
30+
<input
31+
id="buy-me-a-kofi"
32+
placeholder="Ko-fi username"
33+
className="outline-none placeholder-gray-700 w-32 sm:w-1/2 border-t-0 border-l-0 border-r-0 border solid border-gray-900 py-1 px-1 sm:px-2 ml-2 sm:ml-0 focus:border-blue-700"
34+
value={props.support.buyMeAKofi || ""}
35+
onChange={event => props.handleSupportChange("buyMeAKofi", event)}
36+
/>
37+
</div>
2438
</div>
2539
</div>
2640
)

0 commit comments

Comments
 (0)