Skip to content

Commit

Permalink
bump browser deps
Browse files Browse the repository at this point in the history
  • Loading branch information
vojty committed Oct 7, 2024
1 parent db27030 commit 5d2a1b8
Show file tree
Hide file tree
Showing 29 changed files with 4,197 additions and 4,486 deletions.
95 changes: 0 additions & 95 deletions .eslintrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

36 changes: 36 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"include": ["browser/**/*"],
"ignoreUnknown": false,
"ignore": []
},
"formatter": {
"enabled": true,
"indentWidth": 2,
"indentStyle": "space"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noForEach": "off"
}
}
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single"
}
}
}
25 changes: 14 additions & 11 deletions browser/assets/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,50 @@
@tailwind utilities;

@font-face {
font-family: 'GillSans';
src: url('../fonts/GillSansMediumItalic.otf');
font-family: "GillSans";
src: url("../fonts/GillSansMediumItalic.otf");
font-style: italic;
font-weight: 500;
font-display: swap;
}

@font-face {
font-family: 'GillSans';
src: url('../fonts/GillSansBoldItalic.otf');
font-family: "GillSans";
src: url("../fonts/GillSansBoldItalic.otf");
font-style: italic;
font-weight: 700;
font-display: swap;
}

@font-face {
font-family: 'Pretendo';
src: url('../fonts/Pretendo.ttf');
font-family: "Pretendo";
src: url("../fonts/Pretendo.ttf");
font-style: normal;
font-weight: 400;
font-display: swap;
}

@font-face {
font-family: 'NESController';
src: url('../fonts/NES_Controller.ttf');
font-family: "NESController";
src: url("../fonts/NES_Controller.ttf");
font-style: normal;
font-weight: 400;
font-display: swap;
}

.font-nes {
font-family: 'NESController';
/* biome-ignore lint/a11y/useGenericFontNames: <explanation> */
font-family: "NESController";
}

.font-pretendo {
font-family: 'Pretendo';
/* biome-ignore lint/a11y/useGenericFontNames: <explanation> */
font-family: "Pretendo";
}

.font-gills-sans {
font-family: 'GillSans';
/* biome-ignore lint/a11y/useGenericFontNames: <explanation> */
font-family: "GillSans";
}

html,
Expand Down
8 changes: 5 additions & 3 deletions browser/components/gameboy/Display.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from 'react'
import type { ReactNode } from 'react'

import { Styled } from './GameBoy.styled'

Expand All @@ -12,13 +12,15 @@ export function Display(props: Props) {
<Styled.Display>
<Styled.DisplayTop>
<Styled.DisplayLine width="25%" />
<Styled.DisplayHeaderText>DOT MATRIX WITH STEREO SOUND</Styled.DisplayHeaderText>
<Styled.DisplayHeaderText>
DOT MATRIX WITH STEREO SOUND
</Styled.DisplayHeaderText>
<Styled.DisplayLine width="12%" />
</Styled.DisplayTop>

<Styled.DisplayContent>
<Styled.Battery>
<Styled.BatteryIndicator enabled={props.enabled} />
<Styled.BatteryIndicator $enabled={props.enabled} />
BATTERY
</Styled.Battery>

Expand Down
18 changes: 8 additions & 10 deletions browser/components/gameboy/GameBoy.styled.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import styled, { css, ThemedStyledProps } from 'styled-components'

import { Theme } from '../../types'
import styled, { css, type ExecutionContext } from 'styled-components'

const SCREEN_PADDING_LEFT = 45
const SCREEN_PADDING_TOP = 23
Expand All @@ -16,8 +14,8 @@ const ARROW_SIZE = 26
const TEXT_COLOR = '#393C81'
const AB_COLOR = '#8A205E'

function zoom<P, T extends Theme>(value: number) {
return (props: ThemedStyledProps<P, T>) => `${props.theme.zoom * value}px`
function zoom(value: number) {
return (props: ExecutionContext) => `${props.theme.zoom * value}px`
}

function activeButtonEffect() {
Expand Down Expand Up @@ -93,8 +91,8 @@ const ScreenOverlay = styled.div`
bottom: 0;
`

const BatteryIndicator = styled.div<{ enabled?: boolean }>`
background-color: ${(props) => (props.enabled ? `#f00` : '#000')};
const BatteryIndicator = styled.div<{ $enabled?: boolean }>`
background-color: ${(props) => (props.$enabled ? '#f00' : '#000')};
box-shadow: 0 0 3px 1px #ef5350;
height: ${zoom(INDICATOR_SIZE)};
width: ${zoom(INDICATOR_SIZE)};
Expand Down Expand Up @@ -210,8 +208,8 @@ const ButtonsStartSelect = styled.div`
const Arrows = styled.div``

export enum ArrowOrientation {
HORIZONTAL,
VERTICAL
HORIZONTAL = 0,
VERTICAL = 1,
}

const ArrowsLine = styled.div`
Expand Down Expand Up @@ -347,5 +345,5 @@ export const Styled = {
ArrowCenter,
ArrowStripe,
Speakers,
Speaker
Speaker,
}
22 changes: 14 additions & 8 deletions browser/components/gameboy/GameBoy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ForwardedRef, forwardRef } from 'react'
import { type ForwardedRef, forwardRef } from 'react'

import { JsKeys } from '../../../gb-web/pkg'
import { useInput } from '../../hooks/useInput'
Expand All @@ -11,7 +11,7 @@ export const DISPLAY_HEIGHT = 144

function GameBoyComponent(
{ running }: { running: boolean },
ref: ForwardedRef<HTMLCanvasElement | null>
ref: ForwardedRef<HTMLCanvasElement | null>,
) {
const { zoom } = useTheme()
const { input, onKeyDown, onKeyUp } = useInput()
Expand All @@ -35,15 +35,17 @@ function GameBoyComponent(
style={{
display: 'block', // prevents wierd margin
imageRendering: 'pixelated',
zoom
zoom,
}}
height={DISPLAY_HEIGHT}
width={DISPLAY_WIDTH}
/>
</Display>

<div className="flex items-baseline">
<Styled.NintendoText className="font-pretendo">Nintendo</Styled.NintendoText>
<Styled.NintendoText className="font-pretendo">
Nintendo
</Styled.NintendoText>
<Styled.GameBoyText className="font-gills-sans font-medium italic">
GAME&nbsp;BOY
</Styled.GameBoyText>
Expand All @@ -58,7 +60,8 @@ function GameBoyComponent(
onPointerDown={() => onKeyDown(JsKeys.ArrowUp)}
onPointerUp={() => onKeyUp(JsKeys.ArrowUp)}
$orientation={ArrowOrientation.HORIZONTAL}
$pressed={pressedUp}>
$pressed={pressedUp}
>
<Styled.ArrowStripe />
<Styled.ArrowStripe />
<Styled.ArrowStripe />
Expand All @@ -69,7 +72,8 @@ function GameBoyComponent(
onPointerDown={() => onKeyDown(JsKeys.ArrowLeft)}
onPointerUp={() => onKeyUp(JsKeys.ArrowLeft)}
$orientation={ArrowOrientation.VERTICAL}
$pressed={pressedLeft}>
$pressed={pressedLeft}
>
<Styled.ArrowStripe />
<Styled.ArrowStripe />
<Styled.ArrowStripe />
Expand All @@ -79,7 +83,8 @@ function GameBoyComponent(
onPointerDown={() => onKeyDown(JsKeys.ArrowRight)}
onPointerUp={() => onKeyUp(JsKeys.ArrowRight)}
$orientation={ArrowOrientation.VERTICAL}
$pressed={pressedRight}>
$pressed={pressedRight}
>
<Styled.ArrowStripe />
<Styled.ArrowStripe />
<Styled.ArrowStripe />
Expand All @@ -90,7 +95,8 @@ function GameBoyComponent(
onPointerDown={() => onKeyDown(JsKeys.ArrowDown)}
onPointerUp={() => onKeyUp(JsKeys.ArrowDown)}
$orientation={ArrowOrientation.HORIZONTAL}
$pressed={pressedDown}>
$pressed={pressedDown}
>
<Styled.ArrowStripe />
<Styled.ArrowStripe />
<Styled.ArrowStripe />
Expand Down
2 changes: 1 addition & 1 deletion browser/components/gameboy/Zoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Styled = {
`,
Value: styled.div`
margin: 0 5px;
`
`,
}

export function Zoom(props: Props) {
Expand Down
3 changes: 1 addition & 2 deletions browser/components/pages/Debugger.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect } from 'react'
import styled, { createGlobalStyle } from 'styled-components'

import { WebHandle } from '../../../debugger-web/pkg'
import type { WebHandle } from '../../../debugger-web/pkg'
import { roms } from '../../romsList'

const CANVAS_ID = 'debugger'
Expand Down Expand Up @@ -49,7 +49,6 @@ export function Debugger() {
}
appHandler = await app.start(canvas, roms)
} catch (error) {
// eslint-disable-next-line no-console
console.error(error)
}
}
Expand Down
8 changes: 5 additions & 3 deletions browser/components/pages/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Link } from 'react-router-dom'
import styled from 'styled-components'

import { ReactComponent as Feather } from '../../assets/images/feather.svg'
import { ReactComponent as GameboyLogo } from '../../assets/images/gameboy.svg'
import Feather from '../../assets/images/feather.svg?react'
import GameboyLogo from '../../assets/images/gameboy.svg?react'

const Nintendo = styled.span`
font-size: 30px;
Expand All @@ -28,7 +28,9 @@ export function Landing() {
<span className="text-xl mr-3">Just another</span>
<div className="flex items-baseline justify-center flex-wrap">
<Nintendo className="font-pretendo mr-2">Nintendo</Nintendo>
<GameBoy className="font-gills-sans font-bold italic">GAME&nbsp;BOY</GameBoy>
<GameBoy className="font-gills-sans font-bold italic">
GAME&nbsp;BOY
</GameBoy>
</div>
<span className="text-xl ml-3">emulator</span>
</div>
Expand Down
Loading

0 comments on commit 5d2a1b8

Please sign in to comment.