60 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-08-28 00:07:24 +04:00
import { AppleOutlined, AndroidOutlined } from '@ant-design/icons';
import { Tabs } from 'antd';
import React from 'react';
import { PlaylistsBlock } from '../menuComponents/PlaylistsBlock';
import { IAlbum, IGenre, IPlaylist, ISong } from '../../models/IModels';
2024-11-06 12:48:48 +04:00
import { NewSongsBlock } from '../menuComponents/NewSongsBlock';
import { FullPlaylistBlock } from '../menuComponents/FullPlaylistBlock';
import { width } from '@mui/system';
2024-11-06 12:48:48 +04:00
import TabPane from 'antd/es/tabs/TabPane';
import { ChartSongsBlock } from '../menuComponents/ChartSongsBlock';
2024-08-28 00:07:24 +04:00
interface MenuBlockProps {
playlists?: IPlaylist[],
songs?: ISong[],
albums?: IAlbum[],
genres?: IGenre[],
}
export function MenuBlock({playlists, songs, albums, genres}: MenuBlockProps) {
2024-11-06 12:48:48 +04:00
const newSongsTab = {
label: 'Новинки',
key: 'New',
children: songs? <NewSongsBlock /> : null
2024-08-28 00:07:24 +04:00
};
const playlistsTab = {
label: 'Плейлисты',
key: 'Playlists',
2024-09-20 17:04:13 +04:00
children: playlists && genres ? <FullPlaylistBlock playlists={playlists} genres={genres}/> : null
2024-08-28 00:07:24 +04:00
};
2024-11-06 12:48:48 +04:00
const chartTab = {
label: 'Чарт',
key: 'Chart',
children: songs? <ChartSongsBlock /> : null
};
const recTab = {
label: 'Рекомендации',
key: 'Recomendations',
children: songs? <NewSongsBlock /> : null
2024-08-28 00:07:24 +04:00
};
2024-11-06 12:48:48 +04:00
const tabs = [recTab, newSongsTab, chartTab, playlistsTab];
2024-08-28 00:07:24 +04:00
return (
2024-09-20 09:56:32 +04:00
<div className="flex" style={{display: 'flex', alignSelf: 'flex-start', width: 'fit-content'}}>
2024-08-28 00:07:24 +04:00
<Tabs
2024-11-06 12:48:48 +04:00
2024-09-06 01:03:47 +04:00
type="line"
2024-09-20 09:56:32 +04:00
className='container flex justify-start menu-block'
2024-11-06 12:48:48 +04:00
defaultActiveKey="New"
items={tabs}
2024-09-06 01:03:47 +04:00
style={{padding: '1%'}}
2024-11-06 12:48:48 +04:00
>
</Tabs>
2024-08-28 00:07:24 +04:00
</div>
2024-08-28 00:07:24 +04:00
);
}