Skip to content

Commit

Permalink
Very basic site framework
Browse files Browse the repository at this point in the history
  • Loading branch information
nburka committed May 26, 2021
1 parent 67a9951 commit a2769ec
Show file tree
Hide file tree
Showing 19 changed files with 2,313 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false

[Jenkinsfile]
indent_size = 4
151 changes: 151 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
const config = require('eslint-config-react-app');

function updateWarnRulesToErrorRules(rules) {
const newRules = {};

Object.keys(rules).forEach((key) => {
const value = rules[key];
if (Array.isArray(value)) {
newRules[key] = value.map((part) => (part === 'warn' ? 'error' : part));
} else if (value === 'warn') {
newRules[key] = 'error';
} else {
newRules[key] = value;
}
});

return newRules;
}

function convertOverridesToArray(overrides) {
if (!Array.isArray(overrides)) {
return [overrides];
}
return overrides;
}

// Extend the create-react-app config and set all warnings to errors. Also add
// config extensions for Prettier integration, and our own rules (based on
// tslint-react).
const newConfig = Object.assign({}, config, {
extends: ['plugin:prettier/recommended'],
rules: Object.assign(updateWarnRulesToErrorRules(config.rules), {
'react/jsx-boolean-value': ['error', 'always'],
'react/jsx-key': 'error',
'react/jsx-no-bind': ['error', { allowArrowFunctions: true }],
'react/self-closing-comp': 'error',
'react/no-string-refs': 'error',
'react/jsx-curly-brace-presence': 'error',
// Next.js prefers implicit import of React
'react/react-in-jsx-scope': 'off',

'constructor-super': 'error',
curly: 'error',
'dot-notation': 'error',
'guard-for-in': 'error',
'new-parens': 'error',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'warn',
'no-debugger': 'error',
'no-empty': 'error',
'no-empty-function': 'error',
'no-new-wrappers': 'error',
'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-const': 'error',
radix: 'error',
'use-isnan': 'error',
'no-shadow': 'error',
'no-unused-expressions': 'error',
quotes: [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
// Override create-react-app to ignore ARIA role attributes on non-DOM
// nodes like the Author component. See
// https://github.com/evcohen/eslint-plugin-jsx-a11y/pull/171
'jsx-a11y/aria-role': ['error', { ignoreNonDOM: true }],
// Next.js Link API requires using weird non-accessible syntax. See
// https://github.com/vercel/next.js/issues/5533
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton']
}
]
}),
overrides: convertOverridesToArray(config.overrides).map((override) => {
if (override.parser === '@typescript-eslint/parser') {
// Add our custom TypeScript rules here. These are based on
// tslint/recommended.
return Object.assign({}, override, {
rules: Object.assign(updateWarnRulesToErrorRules(override.rules), {
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': [
'error',
{ default: 'array-simple' }
],
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['variableLike', 'memberLike'],
format: ['camelCase']
},
{
selector: ['property', 'variable'],
format: ['camelCase', 'UPPER_CASE']
},
{
selector: ['function', 'parameter'],
format: ['camelCase', 'PascalCase']
},
{ selector: 'typeLike', format: ['PascalCase'] }
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
overrides: {
constructors: 'no-public'
}
}
],
'@typescript-eslint/consistent-type-assertions': [
'error',
{ assertionStyle: 'as' }
],
'@typescript-eslint/consistent-type-definitions': [
'error',
'interface'
],
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/triple-slash-reference': [
'error',
{ types: 'prefer-import' }
],
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/unified-signatures': 'error'
})
});
}
return Object.assign({}, override, {
rules: updateWarnRulesToErrorRules(override.rules)
});
})
});

module.exports = newConfig;
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
printWidth: 80,
singleQuote: true,
trailingComma: 'none'
};
8 changes: 8 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-css-modules",
"stylelint-config-prettier",
"stylelint-prettier/recommended"
]
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# healthicons
A collection of open source icons for public health projects.
This is a starter template for [Learn Next.js](https://nextjs.org/learn).
17 changes: 17 additions & 0 deletions components/TopBar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.topBar {
padding: 0 0 1rem 0;
display: flex;
}

.title {
font-weight: bold;
}

.links {
margin-left: auto;
}

.link {
display: inline-block;
padding: 0 0 0 2rem;
}
18 changes: 18 additions & 0 deletions components/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Link from 'next/link';
import styles from './TopBar.module.css';

export function TopBar() {
return (
<div className={styles.topBar}>
<Link href="/">
<a className={styles.title}>Health Icons</a>
</Link>
<div className={styles.links}>
<Link href="/request"><a className={styles.link}>Request an icon</a></Link>
<a href="/download" className={styles.link}>Download All</a>
<a href="https://github.com/resolvetosavelives/healthicons" className={styles.link}>Github</a>
<Link href="/about"><a className={styles.link}>About</a></Link>
</div>
</div>
);
}
2 changes: 2 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "learn-starter",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^10.0.0",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"devDependencies": {
"@types/react": "^17.0.7",
"typescript": "^4.2.4"
}
}
6 changes: 6 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { AppProps } from 'next/app';
import '../styles/global.css';

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
20 changes: 20 additions & 0 deletions pages/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Head from 'next/head'
import { TopBar } from '../components/TopBar';

export default function About() {
return (
<div className="container">
<Head>
<title>Health Icons - About</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<TopBar />
<main>
<h1 className="title">
About
</h1>
</main>
</div>
)
}
6 changes: 6 additions & 0 deletions pages/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.box {
background: #f5fdfc;
padding: 4rem;
border-radius: 1rem;
text-align: center;
}
25 changes: 25 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Head from 'next/head';
import { TopBar } from '../components/TopBar';
import styles from './index.module.css';

export default function Home() {
return (
<div className="container">
<Head>
<title>Health Icons</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<TopBar />
<main>
<div className={styles.box}>
<h1>Free, open source health icons available for any use</h1>
<h3>
Use for your next commerical or personal project. You don’t need to
give credit and you can edit the icons however you want.
</h3>
</div>
</main>
</div>
);
}
Binary file added public/favicon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a2769ec

Please sign in to comment.