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 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 = () => {
|
||||
switch (status) {
|
||||
case true:
|
||||
return 'green';
|
||||
const getFrameworkSource = () => {
|
||||
switch (framework) {
|
||||
case "bukkit":
|
||||
return bukkit;
|
||||
case "spigot":
|
||||
return spigot;
|
||||
case "paper":
|
||||
return paper;
|
||||
default:
|
||||
return 'gray';
|
||||
return vanilla;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleRun = async () => {
|
||||
try {
|
||||
@ -43,7 +50,7 @@ const ServerCard = ({status, version, link, name, onRunClick, onStopClick, onDel
|
||||
<div className={styles.leftCard}>
|
||||
<div className={styles.status}>
|
||||
<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>
|
||||
<div className={styles.buttonContainer}>
|
||||
|
@ -30,7 +30,6 @@
|
||||
.statusInnerDot {
|
||||
width: 27px;
|
||||
height: 27px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.name {
|
||||
|
Loading…
Reference in New Issue
Block a user