feat:add support for css modules

This commit is contained in:
unknown committed 2026-06-22 22:28:18 +02:00
1 parent 3cdd4eb0d0
commit c8e576d44f
9 files changed
+472 -21

No files matched your search

@@ -1,30 +1,29 @@
.newsystem.character-sheet,
.newsystem.item-sheet {
.sheet {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0.5rem;
}
.newsystem .attributes {
.attributes {
display: flex;
gap: 1rem;
}
.newsystem label {
.attributeLabel {
display: flex;
flex-direction: column;
font-size: 0.8rem;
text-transform: capitalize;
.modifier {
font-weight: bold;
text-align: center;
}
}
.newsystem .modifier {
font-weight: bold;
text-align: center;
}
.newsystem .totals {
.totals {
display: flex;
gap: 1rem;
font-weight: bold;
}
}
+7 -6
View File
@@ -1,4 +1,5 @@
import React from "react";
import styles from "./CharacterSheetApp.module.scss";
const modifier = (score: number) => Math.floor((score - 10) / 2);
const fmtMod = (mod: number) => (mod >= 0 ? `+${mod}` : `${mod}`);
@@ -20,26 +21,26 @@ export function CharacterSheetApp({ actor }: { actor: any }) {
const totalMod = modifier(attrs.strength) + modifier(attrs.agility) + modifier(attrs.spirit);
return (
<div className="newsystem character-sheet">
<div className={styles.sheet}>
<h1>{actor.name}</h1>
<div className="attributes">
<div className={styles.attributes}>
{(["strength", "agility", "spirit"] as const).map((key) => (
<label key={key}>
<label className={styles.attributeLabel} key={key}>
{key}
<input
type="number"
value={attrs[key]}
onChange={(e) => updateAttribute(key, Number(e.target.value))}
/>
<span className="modifier">{fmtMod(modifier(attrs[key]))}</span>
<span className={styles.modifier}>{fmtMod(modifier(attrs[key]))}</span>
</label>
))}
</div>
<div className="totals">
<div className={styles.totals}>
<span>Total: {total}</span>
<span>Total mod: {fmtMod(totalMod)}</span>
</div>
<label>
<label className={styles.attributeLabel}>
Biography
<textarea
defaultValue={system.biography}
@@ -0,0 +1,13 @@
.sheet {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0.5rem;
}
.label {
display: flex;
flex-direction: column;
font-size: 0.8rem;
text-transform: capitalize;
}
+4 -3
View File
@@ -1,4 +1,5 @@
import React from "react";
import styles from "./ItemSheetApp.module.scss";
export function ItemSheetApp({ item }: { item: any }) {
const system = item.system;
@@ -12,9 +13,9 @@ export function ItemSheetApp({ item }: { item: any }) {
};
return (
<div className="newsystem item-sheet">
<div className={styles.sheet}>
<h1>{item.name}</h1>
<label>
<label className={styles.label}>
Quantity
<input
type="number"
@@ -23,7 +24,7 @@ export function ItemSheetApp({ item }: { item: any }) {
onChange={(e) => updateQuantity(Number(e.target.value))}
/>
</label>
<label>
<label className={styles.label}>
Description
<textarea
defaultValue={system.description}
-1
View File
@@ -1,4 +1,3 @@
import "./styles/main.css";
import { CharacterData } from "./data/character-data";
import { ItemData } from "./data/item-data";
import { CharacterSheet } from "./sheets/character-sheet";
+5
View File
@@ -9,3 +9,8 @@ declare const game: any;
declare const foundry: any;
declare const Actor: any;
declare const Item: any;
declare module "*.module.scss" {
const classes: { readonly [key: string]: string };
export default classes;
}