Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Commit

Permalink
1st commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ophum committed Jun 4, 2021
1 parent 519d31f commit 93f2654
Show file tree
Hide file tree
Showing 14 changed files with 4,407 additions and 104 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off"
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.env
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tabWidth": 2,
"printWidth": 80,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"trailingComma": "es5",
"arrowParens": "always",
"parser": "typescript"
}
11 changes: 11 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app"
]
}
10 changes: 10 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
}
25 changes: 24 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
Expand All @@ -13,19 +15,32 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"sass": "^1.34.1",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"overrides": [
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
},
"browserslist": {
Expand All @@ -39,5 +54,13 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@storybook/addon-actions": "^6.2.9",
"@storybook/addon-essentials": "^6.2.9",
"@storybook/addon-links": "^6.2.9",
"@storybook/node-logger": "^6.2.9",
"@storybook/preset-create-react-app": "^3.1.7",
"@storybook/react": "^6.2.9"
}
}
2 changes: 1 addition & 1 deletion src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import React from 'react';
import App from './App';

test('renders learn react link', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import logo from './logo.svg';

function App() {
return (
Expand Down
13 changes: 13 additions & 0 deletions src/components/AppBar/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { AppBar, AppBarProps } from '.';

export default {
title: 'Components/AppBar',
component: AppBar,
};

export const Default = (args: AppBarProps) => <AppBar {...args} />;

export const IsAdmin = Default.bind({
isAdmin: true,
});
33 changes: 33 additions & 0 deletions src/components/AppBar/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {
AppBar as MUIAppBar,
Button,
Toolbar,
Typography,
} from '@material-ui/core';
import React from 'react';
import styles from './styles.module.scss';

export interface AppBarProps {
isAdmin?: boolean;
}

export const AppBar: React.FC<AppBarProps> = (props: AppBarProps) => {
const { isAdmin = false } = props;
return (
<MUIAppBar>
<Toolbar>
<Typography variant="h6" className={styles.title}>
ICTSC
</Typography>
<Button color="inherit">問題</Button>
<Button color="inherit">質問</Button>
{isAdmin && <Button color="inherit">解答</Button>}
<Button color="inherit">ガイド</Button>
<Button color="inherit">チーム</Button>
<Button color="inherit" variant="outlined">
ログアウト
</Button>
</Toolbar>
</MUIAppBar>
);
};
3 changes: 3 additions & 0 deletions src/components/AppBar/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.title {
flex-grow: 1;
}
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import './index.css';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
Expand Down
Loading

0 comments on commit 93f2654

Please sign in to comment.