Skip to content

Commit a6b9364

Browse files
author
javadoug
committed
initial code - written as a challenge in less than 8 hours
1 parent fd9edd8 commit a6b9364

15 files changed

+7682
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,6 @@ typings/
5959

6060
# next.js build output
6161
.next
62+
63+
.DS_Store
64+
.idea

package.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "ov-date-range-picker",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"prop-types": "^15.6.1",
7+
"react": "^16.3.0",
8+
"react-dom": "^16.3.0",
9+
"react-scripts": "1.1.1"
10+
},
11+
"scripts": {
12+
"start": "react-scripts start",
13+
"build": "react-scripts build",
14+
"test": "react-scripts test --env=jsdom",
15+
"eject": "react-scripts eject",
16+
"prettier": "prettier --write {src,public}/**/*.{js,css}"
17+
},
18+
"devDependencies": {
19+
"prettier": "^1.14.2"
20+
},
21+
"prettier": {
22+
"semi": false,
23+
"useTabs": true,
24+
"tabWidth": 4,
25+
"singleQuote": true,
26+
"printWidth": 90
27+
}
28+
}

public/favicon.ico

3.78 KB
Binary file not shown.

public/index.html

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="theme-color" content="#000000">
7+
<!--
8+
manifest.json provides metadata used when your web app is added to the
9+
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
10+
-->
11+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
12+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
13+
<!--
14+
Notice the use of %PUBLIC_URL% in the tags above.
15+
It will be replaced with the URL of the `public` folder during the build.
16+
Only files inside the `public` folder can be referenced from the HTML.
17+
18+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
19+
work correctly both with client-side routing and a non-root public URL.
20+
Learn how to configure a non-root public URL by running `npm run build`.
21+
-->
22+
<title>React App</title>
23+
</head>
24+
<body>
25+
<noscript>
26+
You need to enable JavaScript to run this app.
27+
</noscript>
28+
<div id="root"></div>
29+
<!--
30+
This HTML file is a template.
31+
If you open it directly in the browser, you will see an empty page.
32+
33+
You can add webfonts, meta tags, or analytics to this file.
34+
The build step will place the bundled scripts into the <body> tag.
35+
36+
To begin the development, run `npm start` or `yarn start`.
37+
To create a production bundle, use `npm run build` or `yarn build`.
38+
-->
39+
</body>
40+
</html>

public/manifest.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": "./index.html",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

src/App.css

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
animation: App-logo-spin infinite 20s linear;
7+
height: 80px;
8+
}
9+
10+
.App-header {
11+
background-color: #222;
12+
height: 150px;
13+
padding: 20px;
14+
color: white;
15+
}
16+
17+
.App-title {
18+
font-size: 1.5em;
19+
}
20+
21+
.App-intro {
22+
font-size: large;
23+
}
24+
25+
@keyframes App-logo-spin {
26+
from {
27+
transform: rotate(0deg);
28+
}
29+
to {
30+
transform: rotate(360deg);
31+
}
32+
}

src/App.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React, { Component } from 'react'
2+
import logo from './logo.svg'
3+
import './App.css'
4+
import DateRangePicker from './DateRangePicker'
5+
6+
class App extends Component {
7+
render() {
8+
return (
9+
<div className="App">
10+
<header className="App-header">
11+
<img src={logo} className="App-logo" alt="logo" />
12+
<h1 className="App-title">Welcome to React</h1>
13+
</header>
14+
<p className="App-intro">
15+
To get started, edit <code>src/App.js</code> and save to reload.
16+
</p>
17+
<DateRangePicker />
18+
</div>
19+
)
20+
}
21+
}
22+
23+
export default App

src/App.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*global it*/
2+
import React from 'react'
3+
import ReactDOM from 'react-dom'
4+
import App from './App'
5+
6+
it('renders without crashing', () => {
7+
const div = document.createElement('div')
8+
ReactDOM.render(<App />, div)
9+
ReactDOM.unmountComponentAtNode(div)
10+
})

src/DateRangePicker.css

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.DateRangePicker {
2+
max-width: 350px;
3+
}
4+
5+
.DateRangePicker .week {
6+
display: flex;
7+
}
8+
9+
.DateRangePicker .day {
10+
flex: 0 0 auto;
11+
min-width: 50px;
12+
background-color: aliceblue;
13+
color: #000;
14+
margin: 0;
15+
border: 1px solid transparent;
16+
cursor: pointer;
17+
}
18+
19+
.DateRangePicker .--out-of-start-month {
20+
background-color: #f5f5f5;
21+
color: #aaaaaa;
22+
}
23+
24+
.DateRangePicker .--is-today {
25+
background-color: #cad8d6;
26+
color: #940d16;
27+
}
28+
29+
.DateRangePicker .--is-selected-date {
30+
border: 1px solid darkred;
31+
}

0 commit comments

Comments
 (0)