Skip to content

Commit e573e7c

Browse files
committed
Add the url share widget
1 parent ec50174 commit e573e7c

File tree

5 files changed

+56
-6
lines changed

5 files changed

+56
-6
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,10 @@ my personal site
77
deployment](https://blog.bitsrc.io/deploy-a-gatsby-site-on-github-pages-for-free-f18853c1b7a9)
88

99
[Cover image](https://unsplash.com/photos/8cylkZnxEiE) is from user **eberhard
10-
grossgasteiger** on Unsplash
10+
grossgasteiger** on Unsplash
11+
12+
13+
14+
export NODE_OPTIONS=--openssl-legacy-provider
15+
16+
v18.15.0

content/pages/about/index.mdx

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ import Me from "./me"
77

88
<Me />
99

10-
I'm Blake and I write code for work, fun, and for the social good. I am the
11-
president of my college's Open Source Club and through it I hope to de-mystify
12-
programming for all.
10+
I'm Blake and I write code for work, fun, and for the social good.
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Share From Url"
3+
date: 2023-06-12
4+
tags:
5+
- Projects
6+
---
7+
import ShareFromUrl from "./share"
8+
9+
10+
11+
<ShareFromUrl />
12+
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from "react";
2+
3+
4+
/*
5+
* @author Blake Vente
6+
*/
7+
8+
// styles
9+
const marginPad = {
10+
margin: "10px",
11+
padding: "10px",
12+
}
13+
14+
const fillContainer = {
15+
backgroundColor: "white",
16+
width: "100%", // 256 + 2 * padding
17+
whiteSpace: 'pre-line',
18+
...marginPad
19+
}
20+
21+
// if I want to add a copy button later https://stackoverflow.com/a/74018673
22+
export default function ShareFromUrl() {
23+
if (typeof window === `undefined`) {
24+
return <pre>It doesn't look like anything to me</pre>;
25+
}
26+
const maybeHref = window?.location?.href ?? "";
27+
28+
const currentLocation = new URL(maybeHref).searchParams.get("urlData") ?? "I got nothing to show. The query parameter `urlData` was empty";
29+
return (
30+
<pre style={fillContainer}>
31+
{decodeURI(currentLocation)}
32+
</pre>
33+
);
34+
}

gatsby-config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ module.exports = {
4242
externalLinks: [
4343
{
4444
name: `Twitter`,
45-
url: `https://twitter.com/blakeistics/`,
45+
url: `https://twitter.com/eigenblake/`,
4646
},
4747
{
4848
name: `Insta`,
49-
url: `https://www.instagram.com/blakeistics/`,
49+
url: `https://www.instagram.com/eigenblake/`,
5050
},
5151
],
5252
},

0 commit comments

Comments
 (0)