Skip to content

Commit

Permalink
Add Regexper links to each example
Browse files Browse the repository at this point in the history
Resolves #20
  • Loading branch information
shreyasminocha committed May 2, 2020
1 parent 82e3f8a commit 2240846
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/components/example/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
line-height: 1.9;
}

.example .regexr-link {
.example .demo-link {
margin-left: 1em;
opacity: 0.6;
}

.example .regexr-link:hover,
.example .regexr-link:active,
.example .regexr-link:focus {
.example .demo-link:hover,
.example .demo-link:active,
.example .demo-link:focus {
color: hsl(219, 100%, 47%);
opacity: 1;
}

@media print {
.example .regexr-link {
.example .demo-link {
display: none;
}
}
Expand Down
15 changes: 14 additions & 1 deletion src/components/example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const Example = (props) => {
)}&text=${encodeURIComponent(playGroundText)}
`.trim();

const visualizationUrl = `
https://regexper.com/#${encodeURIComponent(regex.toString())}
`.trim();

const noop = ({ children }) => <>{children}</>;
const code = ({ children }) => (
<code className="regex-name">{children}</code>
Expand All @@ -33,13 +37,22 @@ const Example = (props) => {

<a
href={playGroundUrl}
className="regexr-link"
className="demo-link"
target="_blank"
rel="noopener noreferrer"
>
[RegExr]
</a>

<a
href={visualizationUrl}
className="demo-link"
target="_blank"
rel="noopener noreferrer"
>
[Visualization]
</a>

<ul>{testCases(regex, testStrings)}</ul>
</figure>
);
Expand Down

1 comment on commit 2240846

@vercel
Copy link

@vercel vercel bot commented on 2240846 May 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.