Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: small enhancements #1870

Merged
merged 1 commit into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs-site/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000" />
<meta name="description" content="A simple and reusable datepicker component for React.">
<meta name="keywords" content="React, HTML, CSS, JavaScript, JSX, date, datepicker">
<title>React.js Datepicker crafted by HackerOne</title>
<title>React Datepicker crafted by HackerOne</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
</head>

Expand Down
10 changes: 7 additions & 3 deletions docs-site/src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Root = () => {
<div>
<div className="hero">
<div className="hero__content">
<h1 className="hero__title">ReactJS Datepicker</h1>
<h1 className="hero__title">React Datepicker</h1>
<div className="hero__crafted-by">
<a href="https://hackerone.com" className="hero__crafted-by-link">
Crafted by{" "}
Expand All @@ -25,15 +25,15 @@ const Root = () => {
</div>
<div className="hero__example">
<DatePicker
autoFocus
open
selected={startDate}
onChange={date => setStartDate(date)}
/>
</div>
</div>
</div>
<div className="wrapper">
<h1>ReactJS Datepicker</h1>
<h1>React Datepicker</h1>
<p className="badges">
<a href="https://npmjs.org/package/react-datepicker">
<img
Expand Down Expand Up @@ -75,6 +75,10 @@ const Root = () => {
<p>
<code>yarn add react-datepicker</code>
</p>
<p>
Below are examples which also can be edited directly via the editor on
the left side and will be rendered on the right.
</p>
</div>
<div className="wrapper">
<ExampleComponents />
Expand Down
1 change: 1 addition & 0 deletions docs-site/src/components/Example/edit-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions docs-site/src/components/Example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ptBR from "date-fns/locale/pt-BR";
import slugify from "slugify";
import range from "lodash/range";
import prismGitHubTheme from "prism-react-renderer/themes/github";
import editIcon from "./edit-regular.svg";

export default class CodeExampleComponent extends React.Component {
static propTypes = {
Expand All @@ -31,7 +32,7 @@ export default class CodeExampleComponent extends React.Component {
<h2 className="example__heading">{title}</h2>
<div className="row">
<LiveProvider
code={component}
code={component.trim()}
scope={{
PropTypes,
useState,
Expand All @@ -44,9 +45,14 @@ export default class CodeExampleComponent extends React.Component {
theme={prismGitHubTheme}
>
<pre className="column example__code">
<img
src={editIcon}
className="example__code__edit_icon"
alt="edit icon"
/>
<LiveEditor />
</pre>
<div className="column">
<div className="column example__preview">
<LiveError />
<LivePreview />
</div>
Expand Down
21 changes: 16 additions & 5 deletions docs-site/src/components/Examples/examples.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@
}

&__code {
position: relative;
background-color: #f5f8fb;
padding: 20px;
margin: 0 -20px 20px;
padding: 5px;
margin: 0 -20px;
border-top: 1px solid #d8e4ef;
border-bottom: 1px solid #d8e4ef;
overflow-x: auto;
Expand All @@ -82,10 +83,20 @@
margin-bottom: 0;
}

code {
background: none;
border: 0;
textarea:focus {
outline: 0;
}

&__edit_icon {
position: absolute;
top: 0;
right: 0;
width: 20px;
z-index: 10;
}
}
&__preview {
padding: 20px 0;
}
}

Expand Down