From 93f24011f9613b7785b37dc4b0c963d9be22ba30 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 21 Apr 2021 09:17:48 +0200 Subject: more components without inline css --- components/gameBar.tsx | 53 +++++--------------- components/notificationsArea.tsx | 103 ++++++--------------------------------- components/page.tsx | 27 ++-------- components/recentGames.tsx | 34 +++---------- components/ui.tsx | 19 ++------ 5 files changed, 41 insertions(+), 195 deletions(-) (limited to 'components') diff --git a/components/gameBar.tsx b/components/gameBar.tsx index a3479d5..9a7ca59 100644 --- a/components/gameBar.tsx +++ b/components/gameBar.tsx @@ -1,5 +1,5 @@ -import { CSSProperties, ReactNode } from 'react'; -import { Bubble, Vierkant } from './ui'; +import { ReactNode } from 'react'; +import { Vierkant } from './ui'; import ExitToAppRoundedIcon from '@material-ui/icons/ExitToAppRounded'; import NavigateBeforeRoundedIcon from '@material-ui/icons/NavigateBeforeRounded'; @@ -9,21 +9,17 @@ import SettingsRoundedIcon from '@material-ui/icons/SettingsRounded'; function GameBarModule(props: { children?: ReactNode; onclick?: () => void; + className?: string; }) { return {props.children} ; } -var GameBarSpacer = () =>
; - -var GameBarAlignStyle: CSSProperties = { - display: 'inline-block', -}; - export function GameBar(props: { turn: boolean; player1: boolean; @@ -32,7 +28,7 @@ export function GameBar(props: { }) { return
-
+
{props.active &&
} @@ -44,49 +40,22 @@ export function GameBar(props: { : 'Tegenstander'}
-
- - 0-0 - +
+ 0-0
-
+
- - - - 00:00 - + + 00:00 - - - diff --git a/components/notificationsArea.tsx b/components/notificationsArea.tsx index 9573b72..8ee554a 100644 --- a/components/notificationsArea.tsx +++ b/components/notificationsArea.tsx @@ -1,5 +1,5 @@ import axios from 'axios'; -import { CSSProperties, ReactNode, useContext, useEffect, useState } from 'react'; +import { ReactNode, useContext, useEffect, useState } from 'react'; import { gameInfo, userInfo } from '../api/api'; import { AccountAvatar } from './account'; @@ -35,52 +35,14 @@ export function NotificationsArea(props: { setPreviousMessages(messages); }); - return props.visible && -

Meldingen

-
+ return props.visible && +

Meldingen

+
{props.gameInvites?.map(game => )} {props.friendRequests?.map(user => )} {messages == 0 - &&
-

+ &&
+

Geen meldingen

} @@ -88,48 +50,24 @@ export function NotificationsArea(props: { ; } -var FriendRequestButtonStyle: CSSProperties = { - borderRadius: 6, - display: 'inline-block', - marginLeft: 0, - textAlign: 'center', -}; - function Acceptable(props: { children?: ReactNode; onAccept?: () => void; onDeny?: () => void; }) { - return -
+ return +
{props.children} -
+
} text='Accepteren' /> } text='Verwijderen' /> @@ -171,14 +109,8 @@ function FriendRequest(props: { > -
- Vriendschapsverzoek +
+ Vriendschapsverzoek {props.user.username}
@@ -191,13 +123,8 @@ function GameInvite(props: { }) { return -
- Partijuitnodiging +
+ Partijuitnodiging

{props.game.opponent?.username} diff --git a/components/page.tsx b/components/page.tsx index b8e3dac..b8e8770 100644 --- a/components/page.tsx +++ b/components/page.tsx @@ -1,26 +1,15 @@ -import { Component, CSSProperties, ReactNode } from 'react'; +import { Component, ReactNode } from 'react'; export function CenteredPage(props: { width?: number; children?: ReactNode; - style?: CSSProperties; className?: string; }) { return

-
+
{props.children}
; @@ -28,15 +17,7 @@ export function CenteredPage(props: { export class PageTitle extends Component { render() { - return

+ return

{this.props.children}

; } diff --git a/components/recentGames.tsx b/components/recentGames.tsx index d619eeb..6683e20 100644 --- a/components/recentGames.tsx +++ b/components/recentGames.tsx @@ -1,18 +1,7 @@ import friendlyTime from 'friendly-time'; -import { CSSProperties } from 'react'; import { gameInfo } from '../api/api'; -var LeftAlignedTableColumn: CSSProperties = { - textAlign: 'left', - paddingLeft: 16, -}; - -var RightAlignedTableColumn: CSSProperties = { - textAlign: 'right', - paddingRight: 16, -}; - function GameOutcome(props: { game: gameInfo; }) { var gameStatus = (() => { return { @@ -42,10 +31,10 @@ function GameOutcome(props: { game: gameInfo; }) { } export default function RecentGames(props: { games?: Array; }) { - return
+ return

Recente partijen

{props.games?.length > 0 - ? + ?
@@ -55,19 +44,14 @@ export default function RecentGames(props: { games?: Array; }) { {props.games?.map(game => - -
Tegenstander
- + + {game.opponent?.username} {Math.max(0, game.moves.length - 1)} + {(() => { var timeCreated = new Date(game.created); return friendlyTime(timeCreated); @@ -77,13 +61,7 @@ export default function RecentGames(props: { games?: Array; }) { )}
- :

+ :

Deze gebruiker heeft nog geen partijen gespeeld

}
; diff --git a/components/ui.tsx b/components/ui.tsx index 11914c8..7474240 100644 --- a/components/ui.tsx +++ b/components/ui.tsx @@ -1,4 +1,4 @@ -import { CSSProperties, ReactNode, useEffect, useState } from 'react'; +import { ReactNode, useEffect, useState } from 'react'; import CheckBoxIcon from '@material-ui/icons/CheckBox'; import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'; @@ -70,7 +70,6 @@ export function IconLabelButton(props: { export function Input(props: { label?: string; - style?: CSSProperties; type?: string; id?: string; min?: number; @@ -109,7 +108,6 @@ export function SearchBar(props: { label?: string; }) { export function CheckBox(props: { state?: boolean; - style?: CSSProperties; id?: string; onclick?: (state: boolean) => void; }) { @@ -130,12 +128,7 @@ export function CheckBox(props: { return
{on ? @@ -168,17 +161,15 @@ export function Tuitje() { xmlns='http://www.w3.org/2000/svg' className='tuitje posabs' > - + ; } export function Bubble(props: { children?: ReactNode; + className?: string; }) { - return + return {props.children} ; -- cgit v1.2.3