diff --git a/src/views/friend-list/views/friend-bar/FriendBarView.tsx b/src/views/friend-list/views/friend-bar/FriendBarView.tsx index 941d485c..b1836e64 100644 --- a/src/views/friend-list/views/friend-bar/FriendBarView.tsx +++ b/src/views/friend-list/views/friend-bar/FriendBarView.tsx @@ -3,13 +3,12 @@ import { useFriendListContext } from '../../context/FriendListContext'; import { FriendBarItemView } from '../friend-bar-item/FriendBarItemView'; import { FriendBarViewProps } from './FriendBarView.types'; -const MAX_DISPLAY_COUNT: number = 3; - export const FriendBarView: FC = props => { const { friendListState = null } = useFriendListContext(); const { friends = null } = friendListState; const [ indexOffset, setIndexOffset ] = useState(0); + const [ maxDisplayCount, setMaxDisplayCount ] = useState(3); const onlineFriends = useMemo(() => { @@ -25,19 +24,20 @@ export const FriendBarView: FC = props => const canIncreaseIndex = useMemo(() => { - if((onlineFriends.length <= MAX_DISPLAY_COUNT) || (indexOffset === (onlineFriends.length - 1))) return false; + if((onlineFriends.length <= maxDisplayCount) || (indexOffset === (onlineFriends.length - 1))) return false; return true; - }, [ indexOffset, onlineFriends ]); + }, [ maxDisplayCount, indexOffset, onlineFriends ]); return (
- - - + { Array.from(Array(maxDisplayCount), (e, i) => + { + return ; + }) }