Skip to content

Commit

Permalink
Add CSS and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
neberej committed Feb 20, 2024
1 parent 46664ef commit 689526c
Show file tree
Hide file tree
Showing 17 changed files with 1,172 additions and 880 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.DS_Store
dist
dist
coverage
build
File renamed without changes.
10 changes: 10 additions & 0 deletions configs/tsconfig.webpack.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"sourceMap": true
},
"exclude": [
"../**/*.test.tsx",
"../node_modules"
]
}
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config: Config = {
],
},
setupFilesAfterEnv: [
"<rootDir>/tests/setupTests.ts"
"<rootDir>/configs/setupTests.ts"
],
};

Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dotenv": "^16.4.4",
"eslint-plugin-react": "^7.33.2",
"express": "^4.18.2",
"postcss-loader": "^8.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.0"
Expand All @@ -34,6 +35,7 @@
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"autoprefixer": "^10.4.17",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.10.0",
"eslint": "^8.56.0",
Expand All @@ -45,7 +47,9 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"nodemon": "^3.0.3",
"postcss": "^8.4.35",
"style-loader": "^3.3.4",
"tailwindcss": "^3.4.1",
"terser-webpack-plugin": "^5.3.10",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Binary file added public/favicon.ico
Binary file not shown.
Empty file removed src/App.css
Empty file.
11 changes: 0 additions & 11 deletions src/App.tsx

This file was deleted.

File renamed without changes.
15 changes: 15 additions & 0 deletions src/App/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

import React from "react";
import Header from './../Header/Header'

type AppProps = {
title?: string;
}; /* use `interface` if exporting so that consumers can extend */

const App = ({ title }: AppProps) =>
<div className="elative bg-white px-6 pt-10 pb-8 shadow-xl ring-1 ring-gray-900/5 sm:mx-auto sm:max-w-lg sm:rounded-lg sm:px-10">
<Header/>
<h1 className="text-32l font-bold">{title}</h1>
</div>;

export default App;
19 changes: 19 additions & 0 deletions src/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import React from "react";

const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']

class Header extends React.Component {

today: number = new Date().getDay();

render() {
return (
<div className="text-sky-500 hover:text-sky-600">
Today is: {days[this.today]}
</div>
);
}
}

export default Header;
3 changes: 3 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
5 changes: 3 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import App from "./App/App";
import "./index.css";

const rootElement = document.getElementById("root") as HTMLElement;
const root = createRoot(rootElement);

root.render(
<StrictMode>
<App title="Hello world!"/>
<App title="We are running react-typescript-seed project."/>
</StrictMode>
);

13 changes: 13 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

module.exports = {
content: [
"./public/**/*.html",
"./src/**/*.tsx",
"./src/**/*.css"
],
theme: {
extend: {},
},
plugins: [],
}

16 changes: 14 additions & 2 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ const config: Configuration = {
rules: [
{
test: /.tsx?$/,
use: "ts-loader",
use: [{
loader: 'ts-loader',
options: {
configFile: "configs/tsconfig.webpack.json"
}
}],
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
use: ["style-loader", "css-loader","postcss-loader"],
},
],
},
Expand All @@ -37,6 +42,13 @@ const config: Configuration = {
new CopyWebpackPlugin({
patterns: [{ from: "public" }],
}),
new CopyWebpackPlugin({
patterns: [
{
from: './public/favicon.ico'
},
]
})
],
};

Expand Down
Loading

0 comments on commit 689526c

Please sign in to comment.