import { Fragment, useEffect, useState } from "react" import style from…
- User
import { Fragment, useEffect, useState } from "react" import style from "./admin-feedback.module.css" import { Icon } from "../../../ui-component/icon/icon.component" import { Config } from "../../../utils/config" import { FeedbackType } from "../../../types/feedback.type"
export function AdminFeedback() { // --------------------------------------------------------------------------- // variables // ---------------------------------------------------------------------------
const [show, setShow] = useState(false) const [isLoading, setLoading] = useState(false) const [buildTeams, setBuildTeams] = useState<FeedbackType[]>([]) const [showFullDescription, setShowFullDescription] = useState<boolean[]>( new Array(buildTeams.length).fill(false), )
// --------------------------------------------------------------------------- // effect // ---------------------------------------------------------------------------
useEffect(() => { loader() }, [])
// --------------------------------------------------------------------------- // functions // ---------------------------------------------------------------------------
async function loader() { try { setLoading(true) const response = await fetch(
${Config.url}/api/feedback/get, { method: "GET", headers: { "Content-Type": "application/json" }, credentials: "include", })codeif (!response.ok) { alert("Something went wrong!") return } const result: FeedbackType[] = await response.json() setBuildTeams(result) setLoading(false) } catch (error) { alert("Network error. Please try again.") }}
function toggleDescription(index: number) { setShowFullDescription((prevShowFullDescription) => { const newShowFullDescription = [...prevShowFullDescription] newShowFullDescription[index] = !newShowFullDescription[index] return newShowFullDescription }) }
// --------------------------------------------------------------------------- if (isLoading) { return Loading... } return ( <> {buildTeams.length > 0 && ( {/* --------------------------------------------------------------------------- /} {/ TABLE /} {/ --------------------------------------------------------------------------- */}
code - Assistant
The issue you're facing arises because the parent element of the element with
className={style.loading}is set todisplay: block, which prevents CSS Flexbox properties from being effective on its children. To fix this, you should ensure the immediate parent of the element you're trying to apply on is using . - User
it happens only on small screen. Why ?
- Assistant