mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 00:24:45 +01:00
interepret API response
This commit is contained in:
@@ -17,13 +17,17 @@ interface IState {
|
||||
|
||||
const headers = [
|
||||
{
|
||||
name: 'hot',
|
||||
name: 'ripe',
|
||||
title: 'Hot',
|
||||
},
|
||||
{
|
||||
name: 'new',
|
||||
title: 'New',
|
||||
},
|
||||
{
|
||||
name: 'installed',
|
||||
title: 'Installed',
|
||||
},
|
||||
]
|
||||
|
||||
export class Mods extends React.Component<IProps, IState> {
|
||||
@@ -55,7 +59,7 @@ export class Mods extends React.Component<IProps, IState> {
|
||||
|
||||
<ModHeader onChange={this.setCategory} headers={headers} defaultHeader={'hot'} />
|
||||
|
||||
<ModList sort={this.state.category} />
|
||||
<ModList mode={this.state.category} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
transform: translateZ(1px);
|
||||
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
top: 45%;
|
||||
left: 48.5%;
|
||||
}
|
||||
|
||||
.LoadingCircle > div {
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
}
|
||||
|
||||
.ModHeaderTitle {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
width: 100%;
|
||||
max-width: 20%;
|
||||
}
|
||||
|
||||
.ModHeaderTitle:hover {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React from 'react'
|
||||
import { getMods } from '../../../utils/gamebanana'
|
||||
import { LoadingCircle } from './LoadingCircle'
|
||||
|
||||
import './ModList.css'
|
||||
|
||||
interface IProps {
|
||||
sort: string
|
||||
mode: string
|
||||
}
|
||||
|
||||
interface IState {
|
||||
@@ -16,6 +17,14 @@ export class ModList extends React.Component<IProps, IState> {
|
||||
super(props)
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
if (this.props.mode === 'installed') return
|
||||
|
||||
const mods = await getMods(this.props.mode)
|
||||
|
||||
console.log(mods)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="ModList">
|
||||
|
||||
Reference in New Issue
Block a user