-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Show all members, add cat mascot & fix: LearnBasics.jsx
- Loading branch information
Showing
19 changed files
with
167 additions
and
29 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const sleep = delay => new Promise(resolve => setTimeout(resolve, delay * 1000)) | ||
|
||
export default sleep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {useEffect, useState} from "react"; | ||
import sleep from "../../function/sleep.js"; | ||
|
||
export default function MaskotKucing() { | ||
const [mripat, setMripat] = useState('melek') | ||
async function kedep() { | ||
while (true) { | ||
await sleep(2) | ||
setMripat('merem') | ||
await sleep(1) | ||
setMripat('melek') | ||
await sleep(0.5) | ||
setMripat('merem') | ||
await sleep(0.25) | ||
setMripat('melek') | ||
} | ||
} | ||
useEffect(() => { | ||
kedep() | ||
}, []) | ||
return <img src={`/pictures/kucing-${mripat}.png`} alt="MaskotKucing" style={{ | ||
position: 'absolute', | ||
top: '-65%', | ||
right: '5%' | ||
}}/> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function ManyMembersContainer({children}) { | ||
return <div className='d-flex flex-column gap-2'>{children}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default function Member({member = {nama: '', panggilan: ''}}) { | ||
return ( | ||
<div className='d-flex flex-column align-items-center gap-2'> | ||
<img src={`pictures/member/${member.panggilan || 'grey'}.png`} alt={member.nama}/> | ||
<p className='mt-1'>{member.nama}</p> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function MemberImageContainer({children, justifyContent}) { | ||
return <div className={`d-flex justify-content-${justifyContent} w-100`}>{children}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,55 @@ | ||
import style from "../../../stylesheet/member.module.css"; | ||
import MemberImageContainer from "./MemberImageContainer.jsx"; | ||
import Member from "./Member.jsx"; | ||
import ManyMembersContainer from "./ManyMembersContainer.jsx"; | ||
import TwoMembersFromManyContainer from "./TwoMembersFromManyContainer.jsx"; | ||
import {useEffect} from "react"; | ||
|
||
export default function StrukturalCard({jabatan = '', members = []}) { | ||
export default function StrukturalCard({jabatan = '', members = [], ikhwan = 3}) { | ||
let countNumber = 0 | ||
const few = members.length < 5 | ||
let justifyContent; | ||
switch (members.length) { | ||
case 1: | ||
justifyContent = 'center' | ||
break | ||
case 2: | ||
justifyContent = 'around' | ||
case 4: | ||
justifyContent = 'evenly' | ||
break | ||
default: | ||
justifyContent = 'evenly' | ||
justifyContent = 'around' | ||
} | ||
const getMemberDiv = (count, from) => { | ||
if (typeof count === 'number') { | ||
let divs = [] | ||
count = typeof from !== 'undefined' ? count + from : count | ||
for (let i = from || 0; i < count; i++) { | ||
divs.push(typeof members[i] !== 'undefined' ? <Member key={i} member={members[i]}/> : <Member />) | ||
countNumber++ | ||
} | ||
return divs | ||
} else { | ||
return members.map((member, index) => <Member member={member} key={index}/>) | ||
} | ||
} | ||
useEffect(() => console.log(members.length), [members]) | ||
return ( | ||
<div className={`${style.card} d-flex flex-column align-items-center gap-2 pt-2 mt-4`}> | ||
<h1 className={style.title}>{jabatan}</h1> | ||
<div className={`d-flex justify-content-${justifyContent} w-100`}> | ||
{few ? members.map((member, index) => | ||
<div key={index} className='d-flex flex-column align-items-center gap-2'> | ||
<img src={`pictures/member/${member.panggilan || 'grey'}.png`} alt={member.nama}/> | ||
<p className='mt-1'>{member.nama}</p> | ||
</div> | ||
) : <div> | ||
|
||
</div>} | ||
</div> | ||
<MemberImageContainer justifyContent={justifyContent}> | ||
{few ? getMemberDiv('all') : ( | ||
<> | ||
<ManyMembersContainer> | ||
<TwoMembersFromManyContainer>{getMemberDiv(2)}</TwoMembersFromManyContainer> | ||
{ikhwan === 3 && members.length === 5 || members.length === 6 ? getMemberDiv(1, countNumber) : <Member />} | ||
</ManyMembersContainer> | ||
<ManyMembersContainer> | ||
{getMemberDiv(1, countNumber)} | ||
<TwoMembersFromManyContainer>{getMemberDiv(2, countNumber)}</TwoMembersFromManyContainer> | ||
</ManyMembersContainer> | ||
</> | ||
)} | ||
</MemberImageContainer> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function TwoMembersFromManyContainer({children}) { | ||
return <div className='d-flex' style={{gap: '10vw'}}>{children}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters