Skip to content
Snippets Groups Projects
Commit bf46dc69 authored by Tomáš Havlíček's avatar Tomáš Havlíček
Browse files

feat: added link to movie in search results

parent 0c1f8c7a
No related branches found
No related tags found
No related merge requests found
import { AudioOutlined } from '@ant-design/icons'; import { AudioOutlined } from '@ant-design/icons';
import { Card, Input, List, Space, Table, Typography } from 'antd'; import { Card, Input, List, Space, Table, Typography } from 'antd';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { cardsDataExample } from './Preview'; import { cardsDataExample } from './Preview';
const { Search } = Input; const { Search } = Input;
...@@ -56,7 +57,7 @@ export const SearchPage = () => { ...@@ -56,7 +57,7 @@ export const SearchPage = () => {
const columns = [{ const columns = [{
title: 'Name', title: 'Name',
dataIndex: 'name', dataIndex: 'name',
render: (text: string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal | null | undefined) => <a href="#">{text}</a>, render: ( text: string, record: MovieIO) => <Link to={`/movie/${record.id}`}><a>{record.name}</a></Link>,
}, { }, {
title: 'Original name', title: 'Original name',
className: 'original-name', className: 'original-name',
...@@ -86,7 +87,7 @@ export const SearchPage = () => { ...@@ -86,7 +87,7 @@ export const SearchPage = () => {
{pressed && <Space direction="vertical" style={{ display: 'flex', padding: 24, textAlign: 'left' }}> {pressed && <Space direction="vertical" style={{ display: 'flex', padding: 24, textAlign: 'left' }}>
<Table <Table
onRow={(record, rowIndex) => { onRow={(record, rowIndex) => {
return{onClick: event => {console.log(record.id)} } //here change to view movie return{onClick: event => {console.log(record.id);} } //here change to view movie
}} }}
columns={columns} columns={columns}
dataSource={resultsExample} dataSource={resultsExample}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment