mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-16 09:04:45 +01:00
mod list colors and such
This commit is contained in:
5
src/ui/Mods.css
Normal file
5
src/ui/Mods.css
Normal file
@@ -0,0 +1,5 @@
|
||||
.Mods {
|
||||
backdrop-filter: blur(10px);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1,29 +1,60 @@
|
||||
import React from 'react'
|
||||
import DownloadHandler from '../utils/download'
|
||||
import { ModHeader } from './components/mods/ModHeader'
|
||||
import { ModList } from './components/mods/ModList'
|
||||
import TopBar from './components/TopBar'
|
||||
|
||||
import './Mods.css'
|
||||
|
||||
interface IProps {
|
||||
downloadHandler: DownloadHandler
|
||||
}
|
||||
|
||||
interface IState {
|
||||
isDownloading: boolean
|
||||
category: string
|
||||
}
|
||||
|
||||
const headers = [
|
||||
{
|
||||
name: 'hot',
|
||||
title: 'Hot',
|
||||
},
|
||||
{
|
||||
name: 'new',
|
||||
title: 'New',
|
||||
},
|
||||
]
|
||||
|
||||
export class Mods extends React.Component<IProps, IState> {
|
||||
constructor(props: IProps) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
isDownloading: false,
|
||||
category: '',
|
||||
}
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
return
|
||||
}
|
||||
|
||||
async setCategory(value: string) {
|
||||
this.setState({
|
||||
category: value,
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<div className="Mods">
|
||||
<TopBar />
|
||||
</>
|
||||
|
||||
<ModHeader onChange={this.setCategory} headers={headers} defaultHeader={'hot'} />
|
||||
|
||||
<ModList sort={this.state.category} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
25
src/ui/components/mods/ModHeader.css
Normal file
25
src/ui/components/mods/ModHeader.css
Normal file
@@ -0,0 +1,25 @@
|
||||
.ModHeader {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
width: 100%;
|
||||
|
||||
padding: 10px;
|
||||
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background: rgba(77, 77, 77, 0.6);
|
||||
}
|
||||
|
||||
.ModHeaderTitle {
|
||||
}
|
||||
|
||||
.ModHeaderTitle:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ModHeaderTitle.selected {
|
||||
border-bottom: 2px solid #fff;
|
||||
}
|
||||
52
src/ui/components/mods/ModHeader.tsx
Normal file
52
src/ui/components/mods/ModHeader.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import React from 'react'
|
||||
|
||||
import './ModHeader.css'
|
||||
|
||||
interface IProps {
|
||||
headers: {
|
||||
title: string
|
||||
name: string
|
||||
}[]
|
||||
onChange: (value: string) => void
|
||||
defaultHeader: string
|
||||
}
|
||||
|
||||
interface IState {
|
||||
selected: string
|
||||
}
|
||||
|
||||
export class ModHeader extends React.Component<IProps, IState> {
|
||||
constructor(props: IProps) {
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
selected: this.props.defaultHeader,
|
||||
}
|
||||
}
|
||||
|
||||
setSelected(value: string) {
|
||||
this.setState({
|
||||
selected: value,
|
||||
})
|
||||
|
||||
this.props.onChange(value)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="ModHeader">
|
||||
{this.props.headers.map((header, index) => {
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className={`ModHeaderTitle ${this.state.selected === header.name ? 'selected' : ''}`}
|
||||
onClick={() => this.setSelected(header.name)}
|
||||
>
|
||||
{header.title}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
6
src/ui/components/mods/ModList.css
Normal file
6
src/ui/components/mods/ModList.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.ModList {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
background-color: rgba(106, 105, 106, 0.6);
|
||||
}
|
||||
21
src/ui/components/mods/ModList.tsx
Normal file
21
src/ui/components/mods/ModList.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import React from 'react'
|
||||
|
||||
import './ModList.css'
|
||||
|
||||
interface IProps {
|
||||
sort: string
|
||||
}
|
||||
|
||||
interface IState {
|
||||
modList: string[]
|
||||
}
|
||||
|
||||
export class ModList extends React.Component<IProps, IState> {
|
||||
constructor(props: IProps) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className="ModList"></div>
|
||||
}
|
||||
}
|
||||
1
src/ui/components/mods/ModTile.tsx
Normal file
1
src/ui/components/mods/ModTile.tsx
Normal file
@@ -0,0 +1 @@
|
||||
export {}
|
||||
Reference in New Issue
Block a user