|
| 1 | +import { Meta, StoryObj } from '@storybook/react'; |
| 2 | +import { hiveThemeDecorator } from '../../../../../.storybook/hive-theme-decorator'; |
| 3 | +import { ComparisonTableProps, ComparisonTable as Table } from './index'; |
| 4 | + |
| 5 | +export default { |
| 6 | + title: 'Components/Table', |
| 7 | + component: Table, |
| 8 | + decorators: [hiveThemeDecorator], |
| 9 | + parameters: { |
| 10 | + padding: true, |
| 11 | + }, |
| 12 | + argTypes: { |
| 13 | + scheme: { |
| 14 | + control: 'select', |
| 15 | + options: ['green', 'neutral'], |
| 16 | + }, |
| 17 | + }, |
| 18 | +} satisfies Meta<ComparisonTableProps>; |
| 19 | + |
| 20 | +export const PerformanceTable: StoryObj<ComparisonTableProps> = { |
| 21 | + render: props => ( |
| 22 | + <Table |
| 23 | + scheme="neutral" |
| 24 | + // highlight can be set with CSS for the cases where it's awkward to add it as a prop |
| 25 | + // `initial` isn't a perfect name for `"yes"`, but this is an edge case for MDX anyway |
| 26 | + className="w-min whitespace-pre [&_tbody_tr:last-child]:[--highlight:initial]" |
| 27 | + {...props} |
| 28 | + > |
| 29 | + <thead> |
| 30 | + <Table.Row> |
| 31 | + <Table.Header>Name</Table.Header> |
| 32 | + <Table.Header>Language</Table.Header> |
| 33 | + <Table.Header>Server</Table.Header> |
| 34 | + <Table.Header>Latency avg</Table.Header> |
| 35 | + <Table.Header>Requests</Table.Header> |
| 36 | + </Table.Row> |
| 37 | + </thead> |
| 38 | + <tbody> |
| 39 | + <Table.Row> |
| 40 | + <Table.Cell>GraphQL Yoga with Response Cache</Table.Cell> |
| 41 | + <Table.Cell>Node.js</Table.Cell> |
| 42 | + <Table.Cell>http</Table.Cell> |
| 43 | + <Table.Cell>46.54ms</Table.Cell> |
| 44 | + <Table.Cell>2.2kps</Table.Cell> |
| 45 | + </Table.Row> |
| 46 | + <Table.Row> |
| 47 | + <Table.Cell>GraphQL Yoga with JIT</Table.Cell> |
| 48 | + <Table.Cell>Node.js</Table.Cell> |
| 49 | + <Table.Cell>http</Table.Cell> |
| 50 | + <Table.Cell>764.83ms</Table.Cell> |
| 51 | + <Table.Cell>120ps</Table.Cell> |
| 52 | + </Table.Row> |
| 53 | + <Table.Row> |
| 54 | + <Table.Cell>GraphQL Yoga</Table.Cell> |
| 55 | + <Table.Cell>Node.js</Table.Cell> |
| 56 | + <Table.Cell>http</Table.Cell> |
| 57 | + <Table.Cell>916.90ms</Table.Cell> |
| 58 | + <Table.Cell>100ps</Table.Cell> |
| 59 | + </Table.Row> |
| 60 | + <Table.Row> |
| 61 | + <Table.Cell>Apollo Server</Table.Cell> |
| 62 | + <Table.Cell>Node.js</Table.Cell> |
| 63 | + <Table.Cell>Express</Table.Cell> |
| 64 | + <Table.Cell>1,234.12ms</Table.Cell> |
| 65 | + <Table.Cell>64ps</Table.Cell> |
| 66 | + </Table.Row> |
| 67 | + </tbody> |
| 68 | + </Table> |
| 69 | + ), |
| 70 | +}; |
| 71 | + |
| 72 | +export const FrameworksTable: StoryObj<ComparisonTableProps> = { |
| 73 | + render: props => ( |
| 74 | + <Table scheme="green" {...props}> |
| 75 | + <thead> |
| 76 | + <Table.Row> |
| 77 | + <Table.Header>Name</Table.Header> |
| 78 | + <Table.Header>Productivity / Maintainability</Table.Header> |
| 79 | + <Table.Header>Unified Schema design</Table.Header> |
| 80 | + <Table.Header>Sub-services support</Table.Header> |
| 81 | + </Table.Row> |
| 82 | + </thead> |
| 83 | + <tbody> |
| 84 | + <Table.Row highlight> |
| 85 | + <Table.Cell>GraphQL Mesh</Table.Cell> |
| 86 | + <Table.Cell> |
| 87 | + Packages with a server, caching, Envelop plugins, and large sub-service types support. |
| 88 | + Configuration-based with custom resolvers. |
| 89 | + </Table.Cell> |
| 90 | + <Table.Cell> |
| 91 | + Flexible Schema design with Transforms and custom resolvers support. |
| 92 | + </Table.Cell> |
| 93 | + <Table.Cell>Support for a large range of types of sub-service and databases.</Table.Cell> |
| 94 | + </Table.Row> |
| 95 | + <Table.Row> |
| 96 | + <Table.Cell>GraphQL Tools</Table.Cell> |
| 97 | + <Table.Cell> |
| 98 | + Programmatic approach at the Gateway level. Type merging makes it easier to deal with |
| 99 | + sub-services conflicts. |
| 100 | + </Table.Cell> |
| 101 | + <Table.Cell>Access to all GraphQL Schema building libraries.</Table.Cell> |
| 102 | + <Table.Cell> |
| 103 | + Only supports GraphQL sub-services out of the box. Other sub-service types can be |
| 104 | + supported with Schema extensions at the Gateway level. |
| 105 | + </Table.Cell> |
| 106 | + </Table.Row> |
| 107 | + <Table.Row> |
| 108 | + <Table.Cell>Apollo Server with DataSources</Table.Cell> |
| 109 | + <Table.Cell> |
| 110 | + Requires a lot of coding and maintenance work at the DataSources level. |
| 111 | + </Table.Cell> |
| 112 | + <Table.Cell>Access to all GraphQL Schema building libraries.</Table.Cell> |
| 113 | + <Table.Cell> |
| 114 | + Integrating with some type of sub-services might require some extra work. |
| 115 | + </Table.Cell> |
| 116 | + </Table.Row> |
| 117 | + <Table.Row> |
| 118 | + <Table.Cell>Apollo Federation</Table.Cell> |
| 119 | + <Table.Cell> |
| 120 | + Rover CLI and Apollo Studio. Only the Apollo Gateway needs maintenance. |
| 121 | + </Table.Cell> |
| 122 | + <Table.Cell>Access to all GraphQL Schema building libraries.</Table.Cell> |
| 123 | + <Table.Cell>Only supports "Federation compliant" GraphQL sub-services.</Table.Cell> |
| 124 | + </Table.Row> |
| 125 | + <Table.Row> |
| 126 | + <Table.Cell>Hasura</Table.Cell> |
| 127 | + <Table.Cell> |
| 128 | + Plug and play solution. Configuration-based with custom resolvers. |
| 129 | + </Table.Cell> |
| 130 | + <Table.Cell> |
| 131 | + The Unified Schema is directly linked to the underlying database schema or sub-services |
| 132 | + design. |
| 133 | + </Table.Cell> |
| 134 | + <Table.Cell> |
| 135 | + Only supports GraphQL and REST sub-services and, a set of databases. |
| 136 | + </Table.Cell> |
| 137 | + </Table.Row> |
| 138 | + </tbody> |
| 139 | + </Table> |
| 140 | + ), |
| 141 | +}; |
0 commit comments