mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-08-30 02:24:42 +08:00
update: phone style
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
> .section {
|
> .section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.5rem;
|
gap: calc(0.5rem * var(--ratio));
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2rem;
|
height: calc(2rem * var(--ratio));
|
||||||
color: var(--base-text-color);
|
color: var(--base-text-color);
|
||||||
border: 0.0625rem solid var(--base-text-color);
|
border: 0.0625rem solid var(--base-text-color);
|
||||||
border-bottom: 0.1875rem solid var(--color-primary);
|
border-bottom: 0.1875rem solid var(--color-primary);
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
height: 2rem;
|
height: calc(2rem * var(--ratio));
|
||||||
font-size: 1rem;
|
font-size: calc(1rem * var(--ratio-font));
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
background: var(--background, var(--base-background-color));
|
background: var(--background, var(--base-background-color));
|
||||||
@@ -17,13 +17,26 @@
|
|||||||
&.selected {
|
&.selected {
|
||||||
--color: var(--base-background-color);
|
--color: var(--base-background-color);
|
||||||
--background: var(--grade-color);
|
--background: var(--grade-color);
|
||||||
&:hover { --background: oklch(from var(--grade-color) calc(l + 0.1) c h); }
|
|
||||||
|
@media (hover: hover) {
|
||||||
|
&:hover { background: oklch(from var(--grade-color) calc(l + 0.1) c h); }
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
background: oklch(from var(--grade-color) calc(l + 0.1) c h);
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (hover: hover) {
|
||||||
|
&:hover { background: oklch(from var(--grade-color) calc(l + 0.5) c h); }
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
background: oklch(from var(--grade-color) calc(l + 0.5) c h);
|
||||||
|
transition: none;
|
||||||
}
|
}
|
||||||
&:hover { --background: oklch(from var(--grade-color) calc(l + 0.5) c h); }
|
|
||||||
.talent-name { font-weight: bold; }
|
.talent-name { font-weight: bold; }
|
||||||
.talent-description {
|
.talent-description {
|
||||||
color: oklch(from var(--color) calc(l + 0.1) c h);
|
color: oklch(from var(--color) calc(l + 0.1) c h);
|
||||||
font-size: 0.85rem;
|
font-size: calc(0.85rem * var(--ratio-font));
|
||||||
user-select: none;
|
user-select: none;
|
||||||
&::before { content: '['; margin-right: 0.125rem; }
|
&::before { content: '['; margin-right: 0.125rem; }
|
||||||
&::after { content: ']'; margin-left: 0.125rem; }
|
&::after { content: ']'; margin-left: 0.125rem; }
|
||||||
@@ -32,8 +45,18 @@
|
|||||||
}
|
}
|
||||||
html[data-theme='dark'] {
|
html[data-theme='dark'] {
|
||||||
.talent{
|
.talent{
|
||||||
&:hover {--background: oklch(from var(--grade-color) calc(l - 0.5) c h);}
|
@media (hover: hover) {
|
||||||
&.selected:hover { --background: oklch(from var(--grade-color) calc(l - 0.1) c h);}
|
&:hover { background: oklch(from var(--grade-color) calc(l - 0.5) c h); }
|
||||||
|
&.selected:hover { background: oklch(from var(--grade-color) calc(l - 0.1) c h); }
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
background: oklch(from var(--grade-color) calc(l - 0.5) c h);
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
&.selected:active {
|
||||||
|
background: oklch(from var(--grade-color) calc(l - 0.1) c h);
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
.talent-description { color: oklch(from var(--color) calc(l - 0.2) c h); }
|
.talent-description { color: oklch(from var(--color) calc(l - 0.2) c h); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { useState, useEffect, useRef } from 'react'
|
||||||
|
export interface Props {
|
||||||
|
text: string
|
||||||
|
className: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TextSvg({ text, className }: Readonly<Props>) {
|
||||||
|
const [height, setHeight] = useState(0)
|
||||||
|
const [width, setWidth] = useState(0)
|
||||||
|
const textRef = useRef<SVGTextElement>(null)
|
||||||
|
useEffect(() => {
|
||||||
|
if (!textRef.current) return
|
||||||
|
const { width, height } = textRef.current.getBBox()
|
||||||
|
setWidth(width)
|
||||||
|
setHeight(height)
|
||||||
|
}, [text, className, textRef])
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
className={className}
|
||||||
|
fill="currentColor"
|
||||||
|
viewBox={`0 0 ${width} ${height}`}
|
||||||
|
>
|
||||||
|
<text
|
||||||
|
ref={textRef}
|
||||||
|
fontSize={10}
|
||||||
|
style={{
|
||||||
|
transform: 'translate(50%,50%)',
|
||||||
|
textAnchor: 'middle',
|
||||||
|
dominantBaseline: 'central',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{text}
|
||||||
|
</text>
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default TextSvg
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
.allocation-input {
|
.allocation-input {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
height: 2rem;
|
height: calc(2rem * var(--ratio));
|
||||||
border: 0.0625rem solid var(--grade-color);
|
border: 0.0625rem solid var(--grade-color);
|
||||||
color: var(--grade-color);
|
color: var(--grade-color);
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@@ -46,11 +46,12 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
transform: translateY(-100%);
|
transform: translateY(-100%);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
font-size: calc(1rem * var(--ratio-font));
|
||||||
li {
|
li {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 2rem;
|
height: calc(2rem * var(--ratio));
|
||||||
padding: 0 0.5rem;
|
padding: 0 0.5rem;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
@@ -67,6 +68,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
font-size: calc(1rem * var(--ratio-font));
|
||||||
> li {
|
> li {
|
||||||
flex: 1 0;
|
flex: 1 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -77,7 +79,7 @@
|
|||||||
gap: 0;
|
gap: 0;
|
||||||
> span {
|
> span {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 2rem;
|
height: calc(2rem * var(--ratio));
|
||||||
color: var(--base-background-color);
|
color: var(--base-background-color);
|
||||||
background: var(--grade-color);
|
background: var(--grade-color);
|
||||||
border: 0.0625rem solid var(--grade-color);
|
border: 0.0625rem solid var(--grade-color);
|
||||||
@@ -100,8 +102,8 @@
|
|||||||
> button {
|
> button {
|
||||||
--style-color: var(--left-color);
|
--style-color: var(--left-color);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 1rem;
|
font-size: calc(1rem * var(--ratio-font));
|
||||||
height: 2rem;
|
height: calc(2rem * var(--ratio));
|
||||||
width: 6rem;
|
width: 6rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
h1 {
|
.main { font-weight: bold; }
|
||||||
font-size: 4rem;
|
|
||||||
margin: 0;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
font-size: 2rem;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.theme-toggle-btn {
|
.theme-toggle-btn {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { useRemake } from '@remake/hooks'
|
import { useRemake } from '@remake/hooks'
|
||||||
|
import { TextSvg } from '@/components/TextSvg'
|
||||||
import { ThemeToggle } from '@/components/ThemeToggle'
|
import { ThemeToggle } from '@/components/ThemeToggle'
|
||||||
import './Home.css'
|
import './Home.css'
|
||||||
|
|
||||||
@@ -7,10 +8,10 @@ export default function Home() {
|
|||||||
return (
|
return (
|
||||||
<div className="screen home">
|
<div className="screen home">
|
||||||
<div className="title">
|
<div className="title">
|
||||||
<h1>人生重开模拟器</h1>
|
<TextSvg text="人生重开模拟器" className="main" />
|
||||||
<h2>这垃圾人生一秒也不想待了</h2>
|
<TextSvg text="这垃圾人生一秒也不想待了" className="sub" />
|
||||||
</div>
|
</div>
|
||||||
<button className="primary" onClick={remake}>
|
<button className="primary focus" onClick={remake}>
|
||||||
立即重开
|
立即重开
|
||||||
</button>
|
</button>
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
|
|||||||
@@ -107,8 +107,8 @@
|
|||||||
> button {
|
> button {
|
||||||
flex: 1 0;
|
flex: 1 0;
|
||||||
min-width: 6rem;
|
min-width: 6rem;
|
||||||
font-size: 1.25rem;
|
font-size: calc(1.25rem * var(--ratio-font));
|
||||||
height: 2.5rem;
|
height: calc(2.5rem * var(--ratio));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
ul.talent-list {
|
ul.talent-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.5rem;
|
gap: calc(0.5rem * var(--ratio));
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
ul.talent-list {
|
ul.talent-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.5rem;
|
gap: calc(0.5rem * var(--ratio));
|
||||||
li {
|
li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ export default function TalentPick() {
|
|||||||
if (!pulled)
|
if (!pulled)
|
||||||
return (
|
return (
|
||||||
<div className="screen talent-pick">
|
<div className="screen talent-pick">
|
||||||
<button className="primary font-mono" onClick={() => puller()}>
|
<button
|
||||||
{PullCount}连抽!
|
className="primary font-mono focus"
|
||||||
|
onClick={() => puller()}
|
||||||
|
>
|
||||||
|
{PullCount} 连抽!
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
|
:root {
|
||||||
|
--ratio: 1;
|
||||||
|
--ratio-font: 1;
|
||||||
|
color: var(--base-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
html { transition: all 0.2s ease-in-out; }
|
html { transition: all 0.2s ease-in-out; }
|
||||||
html[data-theme='light'] { color-scheme: light; }
|
html[data-theme='light'] { color-scheme: light; }
|
||||||
html[data-theme='dark'] { color-scheme: dark; }
|
html[data-theme='dark'] { color-scheme: dark; }
|
||||||
:root { color: var(--base-text-color); }
|
|
||||||
.hide-scrollbar,
|
.hide-scrollbar,
|
||||||
html {
|
html {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
@@ -51,22 +56,42 @@ button {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: var(--border-color) 0.0625rem solid;
|
border: var(--border-color) 0.0625rem solid;
|
||||||
background: var(--background-color);
|
background: var(--background-color);
|
||||||
font-size: 1.2rem;
|
font-size: calc(1.2rem * var(--ratio-font));
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
height: 2.5rem;
|
height: calc(2.5rem * var(--ratio));
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
transition: all 0.2s ease-in-out;
|
transition: all 0.2s ease-in-out;
|
||||||
&:hover {
|
outline: none;
|
||||||
--background-color: var(--style-color);
|
@media (hover: hover) {
|
||||||
--text-color: var(--style-background);
|
&:hover {
|
||||||
|
border: var(--style-background) 0.0625rem solid;
|
||||||
|
background: var(--style-color);
|
||||||
|
color: var(--style-background);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
border: var(--style-background) 0.0625rem solid;
|
||||||
|
background: var(--style-color);
|
||||||
|
color: var(--style-background);
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
&.primary { --style-color: var(--color-primary); }
|
&.primary { --style-color: var(--color-primary); }
|
||||||
&.info { --style-color: var(--color-info); }
|
&.info { --style-color: var(--color-info); }
|
||||||
&.error { --style-color: var(--color-error); }
|
&.error { --style-color: var(--color-error); }
|
||||||
|
&.focus {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: calc(3.5rem * var(--ratio));
|
||||||
|
font-size: calc(1.6rem * var(--ratio-font));
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
@@ -76,7 +101,7 @@ ul {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
font-size: 1rem;
|
font-size: calc(1rem * var(--ratio-font));
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: none;
|
border: none;
|
||||||
@@ -91,4 +116,10 @@ input {
|
|||||||
&::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
|
&::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 32rem) { :root { font-size: 2.88vw; } }
|
@media (max-width: 32rem) { :root { font-size: 2.88vw; } }
|
||||||
|
@media screen and (orientation: portrait) and (pointer: coarse) {
|
||||||
|
:root {
|
||||||
|
--ratio: 1.5;
|
||||||
|
--ratio-font: 1.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user