mirror of
https://github.com/hubHarmony/servii-frontend.git
synced 2024-11-17 21:40:30 +00:00
[~] Dynamic framework icon handling.
This commit is contained in:
parent
3aeb6567df
commit
2d2144fc05
BIN
src/assets/frameworks/vanilla.png
Normal file
BIN
src/assets/frameworks/vanilla.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
@ -1,18 +1,25 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styles from './serverCard.module.scss';
|
import styles from './serverCard.module.scss';
|
||||||
|
|
||||||
import paper_mc from '../../assets/frameworks/paper_mc.png'
|
import paper from '../../assets/frameworks/paper_mc.png'
|
||||||
|
import spigot from '../../assets/frameworks/spigot.png'
|
||||||
|
import bukkit from '../../assets/frameworks/bukkit.png'
|
||||||
|
import vanilla from '../../assets/frameworks/vanilla.png'
|
||||||
|
|
||||||
const ServerCard = ({status, version, link, name, onRunClick, onStopClick, onDeleteClick }) => {
|
const ServerCard = ({status, version, link, name, framework, onRunClick, onStopClick, onDeleteClick }) => {
|
||||||
|
|
||||||
const getStatusColor = () => {
|
const getFrameworkSource = () => {
|
||||||
switch (status) {
|
switch (framework) {
|
||||||
case true:
|
case "bukkit":
|
||||||
return 'green';
|
return bukkit;
|
||||||
|
case "spigot":
|
||||||
|
return spigot;
|
||||||
|
case "paper":
|
||||||
|
return paper;
|
||||||
default:
|
default:
|
||||||
return 'gray';
|
return vanilla;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const handleRun = async () => {
|
const handleRun = async () => {
|
||||||
try {
|
try {
|
||||||
@ -43,7 +50,7 @@ const ServerCard = ({status, version, link, name, onRunClick, onStopClick, onDel
|
|||||||
<div className={styles.leftCard}>
|
<div className={styles.leftCard}>
|
||||||
<div className={styles.status}>
|
<div className={styles.status}>
|
||||||
<div className={styles.name}>{name}</div>
|
<div className={styles.name}>{name}</div>
|
||||||
<img src={paper_mc} alt={`${name} Icon`} className={styles.statusInnerDot}/>
|
<img src={getFrameworkSource()} alt={`${name} Icon`} className={styles.statusInnerDot}/>
|
||||||
<div className="tooltip"></div>
|
<div className="tooltip"></div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.buttonContainer}>
|
<div className={styles.buttonContainer}>
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
.statusInnerDot {
|
.statusInnerDot {
|
||||||
width: 27px;
|
width: 27px;
|
||||||
height: 27px;
|
height: 27px;
|
||||||
border-radius: 50%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
|
Loading…
Reference in New Issue
Block a user