File tree Expand file tree Collapse file tree 4 files changed +47
-8
lines changed
Expand file tree Collapse file tree 4 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,28 @@ const options: Options<City> = {
2929export const WithIcons = ( ) => {
3030 return (
3131 < >
32- < WithIconsCode />
33- < Table data = { cities } options = { options } />
32+ < div className = 'w-100' >
33+ < h3 className = 'light' > With icons</ h3 >
34+ < p className = 'dark' >
35+ Based on some custom logic you can render different data or icons in
36+ the table. In the example below the model looks like this:
37+ < pre >
38+ < code >
39+ { `
40+ {
41+ name: "Vancouver";
42+ weather: "cloudy";
43+ temperature: "21";
44+ km: "3020";
45+ }
46+ ` }
47+ </ code >
48+ </ pre >
49+ Based on weather value different icons rendered instead.
50+ </ p >
51+ < WithIconsCode />
52+ < Table data = { cities } options = { options } />
53+ </ div >
3454 </ >
3555 )
3656}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { Employee } from '../models'
55import { WithLinkCode } from './codeSamples'
66
77const wrapToLink = ( value : any , entry : Employee ) => {
8- return < a href = { `somelink /${ entry } ` } > { value } </ a >
8+ return < a href = { `#link /${ entry . uuid } ` } > { value } </ a >
99}
1010
1111const options : Options < Employee > = {
@@ -19,8 +19,21 @@ const options: Options<Employee> = {
1919export const WithLink = ( ) => {
2020 return (
2121 < >
22- < WithLinkCode />
23- < Table data = { employees } options = { options } />
22+ < div className = 'w-100' >
23+ < h3 className = 'light' > With links</ h3 >
24+ < p className = 'default' >
25+ You can wrap your data around links. Create a function that accepts
26+ value of the property that mentioned in your options.
27+ < pre >
28+ < code > { ` {... name:{displayName: "First name"}}` } </ code >
29+ </ pre >
30+ . The value of name property will be passed to your function.
31+ Optionally the entry object will also be passed to the function. See
32+ below for an example.
33+ </ p >
34+ < WithLinkCode />
35+ < Table data = { employees } options = { options } />
36+ </ div >
2437 </ >
2538 )
2639}
Original file line number Diff line number Diff line change @@ -48,14 +48,20 @@ export const WithSelects = () => {
4848 return `checks: ${ JSON . stringify ( checks ) } `
4949 }
5050 return (
51- < >
51+ < div className = 'w-100' >
52+ < h3 className = 'light' > With checkboxes</ h3 >
53+ < p className = 'dark' >
54+ You can create a wrapper function that is kooks to your component state
55+ and pass it down to the table. It wll allow you render fomr elements and
56+ keep track of their state in you component. See the example below
57+ </ p >
5258 < WithSelectCode />
5359 < div className = 'highlight-wrapper' >
5460 < Highlighter language = 'javascript' style = { atomOneDark } >
5561 { convertStatetoString ( ) }
5662 </ Highlighter >
5763 </ div >
5864 < Table data = { employees } options = { options } />
59- </ >
65+ </ div >
6066 )
6167}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ export const WithLinkCode = () => {
1313 import { Employee } from '../models'
1414
1515 const wrapToLink = (value: any, entry: Employee) => {
16- return <a href={\`somelink/\${entry}\`}>{value}</a>
16+ return <a href={\`somelink/\${entry.uuid }\`}>{value}</a>
1717 }
1818
1919 const options: Options<Employee> = {
You can’t perform that action at this time.
0 commit comments