MostDiscussed

Блок «Самое обсуждаемое»

Props

topics

  • type: IMostDiscussedTopic[]
  • required: true

Объект темы с типом types.ts

headerTag

  • type: string
  • default: 'div'

Тег заголовка у блока

topicHeaderTag

  • type: string
  • default: 'div'

Тег заголовка у каждой статьи

Events

Event namePropertiesDescription
toggle-ratetopicId number - — id топика
isRateUp boolean - — статус изменения рейтинга
Изменение рейтинга

Types

export type MostDiscussedTopic = Record<string, any> & {
  id: number;
  topic: string;
  slug: string;
  date: Date;
  views: number;
  newViews: number;
  comments: number;
  rateGood: number;
  rateBad: number;
  isFavorite: boolean;
  pinned: boolean;
  voting: boolean;
};

Test data

import type { MostDiscussedTopic } from './topic/types';
import { testMostDiscussedTopic } from './topic/test-data';

export const testMostDiscussedTopics: MostDiscussedTopic[] = [
  { ...testMostDiscussedTopic, id: 0 },
  { ...testMostDiscussedTopic, id: 1 },
  { ...testMostDiscussedTopic, id: 2 },
];