Skip to content

Commit

Permalink
chore: add Tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
astone123 committed Sep 2, 2023
1 parent d0ea1b3 commit 43dee4b
Show file tree
Hide file tree
Showing 11 changed files with 1,668 additions and 60 deletions.
1,643 changes: 1,631 additions & 12 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"@vitejs/plugin-react": "^4.0.4",
"autoprefixer": "^10.4.15",
"jsdom": "^22.1.0",
"postcss": "^8.4.29",
"prettier": "2.6.2",
"tailwindcss": "^3.3.3",
"ts-node": "^10.9.1",
"vite": "^4.4.9",
"vite-plugin-svgr": "^3.2.0",
"vite-tsconfig-paths": "^4.2.0",
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
7 changes: 1 addition & 6 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import {useEffect, useState} from 'react';
import _logoWhite from '../assets/top90logo-white.png';
import _logoBlack from '../assets/top90logo-black.png';

const logoStyle = {
height: 250,
cursor: 'pointer',
};

interface HeaderProps {
selectedTheme: string;
onClick?: () => void;
Expand All @@ -29,7 +24,7 @@ export function Header({selectedTheme, onClick}: HeaderProps) {

return (
<div className="d-flex justify-content-center">
<img style={logoStyle} src={logo} onClick={onClick} alt="logo" />
<img className="cursor-pointer h-[250px]" src={logo} onClick={onClick} alt="logo" />
</div>
);
}
7 changes: 3 additions & 4 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ interface InputProps {

function Input({label, placeholder, value, onInput}: InputProps) {
return (
<div style={{width: '100%'}}>
<div className="w-[100%]">
<label className="form-label">{label}</label>
<div style={{borderRadius: '20px'}} className="shadow-sm">
<div className="shadow-sm rounded-full">
<input
style={{borderRadius: '20px'}}
className="form-control"
className="form-control rounded-full"
placeholder={placeholder}
value={value}
onInput={(e: React.ChangeEvent<HTMLInputElement>) => onInput(e.target.value)}
Expand Down
7 changes: 3 additions & 4 deletions src/components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ interface SelectProps {

function Select({label, options, value, onChange}: SelectProps) {
return (
<div className="form-group" style={{width: '100%'}}>
<div className="form-group w-[100%]">
<label className="form-label" htmlFor="select">
{label}
</label>
<div style={{borderRadius: '20px'}} className="shadow-sm">
<div className="shadow-sm rounded-full">
<select
style={{borderRadius: '20px'}}
className="form-select"
className="form-select rounded-full"
name="select"
id="select"
value={value}
Expand Down
3 changes: 1 addition & 2 deletions src/components/ThemeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ function ThemeSelect({onChange}: ThemeSelectProps) {
onChange={onChange}
name="select"
id="select"
style={{borderRadius: '20px'}}
className="form-select mb-4"
className="form-select mb-4 rounded-full"
>
<option value="dark">Dark</option>
<option value="light">Light</option>
Expand Down
16 changes: 3 additions & 13 deletions src/components/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import {API_BASE_URL} from '../api/core';

import {useEffect, useState} from 'react';

const buttonStyle = {
border: 'none',
};

const daysAgoTextStyle = {
fontSize: '14px',
};

const defaultButtonText = 'Copy Link';
const clickedButtonText = 'Link Copied';

Expand Down Expand Up @@ -83,22 +75,20 @@ export function Video({goal}: {goal: Goal}) {
<div className="d-flex justify-content-between align-items-center">
<div>
<button
style={buttonStyle}
onClick={() => copyShareUrl()}
disabled={disableButton}
className="btn btn-outline-secondary btn-sm"
className="btn btn-outline-secondary btn-sm border-none"
>
{buttonText}
</button>
<button
style={buttonStyle}
onClick={() => goToRedditPost(postId(goal.RedditFullname))}
className="btn btn-outline-secondary btn-sm"
className="btn btn-outline-secondary btn-sm border-none"
>
Comments
</button>
</div>
<div style={daysAgoTextStyle} className="fw-light me-2">
<div className="fw-light me-2 text-sm">
{daysAgoText(numDaysAgo(new Date(goal.CreatedAt)))}
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@import 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css';
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
-webkit-font-smoothing: antialiased;
Expand Down
24 changes: 5 additions & 19 deletions src/pages/Goals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ import ThemeSelect from '../components/ThemeSelect';
import {Header} from '../components/Header';
import {getPreferredTheme, setTheme} from '../lib/utils';

const maxWidthContainer = {
maxWidth: '800px',
width: '100%',
};

const form = {
width: '100%',
};

const defaultPagination: Pagination = {skip: 0, limit: 5};

function Goals() {
Expand Down Expand Up @@ -161,10 +152,10 @@ function Goals() {

return (
<div className="container d-flex justify-content-center">
<div style={maxWidthContainer}>
<div className="w-[100%] max-w-[800px]">
<Header selectedTheme={selectedTheme} onClick={reset}></Header>

<form style={form} onSubmit={handleSubmit}>
<form className="w-[100%]" onSubmit={handleSubmit}>
<div className="d-flex">
<Select
label={'League'}
Expand Down Expand Up @@ -204,7 +195,7 @@ function Goals() {
<br></br>

<div className="d-flex">
<div className="flex-grow-1" style={{flexBasis: '0'}}>
<div className="flex-grow-1 basis-0">
<Input
label={'Keyword Search'}
placeholder={'Search anything'}
Expand All @@ -213,16 +204,11 @@ function Goals() {
></Input>
</div>

<div className="flex-grow-1" style={{flexBasis: '0'}}>
<div className="flex-grow-1 basis-0">
<ThemeSelect onChange={changeTheme}></ThemeSelect>
</div>

<button
style={{display: 'none'}}
className="btn btn-primary"
id="searchButton"
type="submit"
/>
<button className="btn btn-primary hidden" id="searchButton" type="submit" />
</div>

<br></br>
Expand Down
8 changes: 8 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {},
},
plugins: [],
};

0 comments on commit 43dee4b

Please sign in to comment.