@@ -2,6 +2,8 @@ import { baseProps } from '../../../stories/lists/baseProps';
22
33import { PrismDiffCode } from './PrismDiffCode' ;
44
5+ import type { CubePrismDiffCodeProps } from './PrismDiffCode' ;
6+
57export default {
68 title : 'Content/PrismDiffCode' ,
79 component : PrismDiffCode ,
@@ -12,18 +14,19 @@ export default {
1214 } ,
1315} ;
1416
15- const Template = ( { ... args } ) => < PrismDiffCode { ...args } /> ;
17+ const Template = ( args : CubePrismDiffCodeProps ) => < PrismDiffCode { ...args } /> ;
1618
1719// export const JavascriptSyntax = Template.bind({});
1820// JavascriptSyntax.args = {
1921// language: 'javascript',
2022// code: ``,
2123// };
2224
23- export const YamlSyntax = Template . bind ( { } ) ;
24- YamlSyntax . args = {
25- language : 'yaml' ,
26- original : `cubes:
25+ export const YamlSyntax = {
26+ render : Template ,
27+ args : {
28+ language : 'yaml' ,
29+ original : `cubes:
2730 # Define the Orders cube
2831 - name: Orders
2932 sql: SELECT * FROM public.orders
@@ -81,7 +84,7 @@ YamlSyntax.args = {
8184 - cube: Orders
8285 sql: \${Customers.id} = \${Orders.customer_id}
8386 relationship: one_to_many # One customer can have many orders` ,
84- modified : `cubes:
87+ modified : `cubes:
8588 # Define the Orders cube
8689 - name: Orders
8790 sql: SELECT * FROM public.orders
@@ -144,12 +147,14 @@ YamlSyntax.args = {
144147 - cube: Orders
145148 sql: \${Customers.id} = \${Orders.customer_id}
146149 relationship: one_to_many # One customer can have multiple orders` ,
150+ } ,
147151} ;
148152
149- export const SqlSyntax = Template . bind ( { } ) ;
150- SqlSyntax . args = {
151- language : 'sql' ,
152- original : `WITH RecursiveCTE AS (
153+ export const SqlSyntax = {
154+ render : Template ,
155+ args : {
156+ language : 'sql' ,
157+ original : `WITH RecursiveCTE AS (
153158 -- Recursive CTE to generate a sequence of numbers
154159 SELECT 1 AS Level, CAST('2025-01-01' AS DATE) AS GeneratedDate
155160 UNION ALL
@@ -202,7 +207,7 @@ SELECT
202207 fo.GeneratedDate
203208FROM FinalOutput fo
204209ORDER BY fo.GeneratedDate, fo.UserID;` ,
205- modified : `WITH RecursiveDates AS (
210+ modified : `WITH RecursiveDates AS (
206211 -- Generate a sequence of dates starting from 2025-01-01
207212 SELECT 1 AS DayNumber, CAST('2025-01-01' AS DATE) AS GeneratedDate
208213 UNION ALL
@@ -253,13 +258,16 @@ SELECT
253258 fo.GeneratedDate
254259FROM FinalOutput fo
255260ORDER BY fo.GeneratedDate, fo.UserID;` ,
261+ } ,
256262} ;
257263
258- export const EmptyLineDiff = Template . bind ( { } ) ;
259- EmptyLineDiff . args = {
260- modified :
261- "cubes:\n - name: orders\n sql: >\n select 1 as id, 100 as amount, 'new' status\n UNION ALL\n select 2 as id, 200 as amount, 'new' status\n UNION ALL\n select 3 as id, 300 as amount, 'processed' status\n UNION ALL\n select 4 as id, 500 as amount, 'processed' status\n UNION ALL\n select 5 as id, 600 as amount, 'shipped' status\n\n joins: []\n\n dimensions:\n - name: id\n type: number\n\n - name: status\n sql: status\n\n\n measures:\n - name: count\n type: count\n\n - name: amount\n sql: amount\n type: sum\n\n pre_aggregations:\n # Pre-aggregation definitions go here.\n # Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started\n\n" ,
262- original :
263- "cubes:\n - name: orders\n sql: >\n select 1 as id, 100 as amount, 'new' status\n UNION ALL\n select 2 as id, 200 as amount, 'new' status\n UNION ALL\n select 3 as id, 300 as amount, 'processed' status\n UNION ALL\n select 4 as id, 500 as amount, 'processed' status\n UNION ALL\n select 5 as id, 600 as amount, 'shipped' status\n\n joins: []\n\n dimensions:\n - name: id\n\n - name: status\n sql: status\n\n\n measures:\n - name: count\n type: count\n\n - name: amount\n sql: amount\n type: sum\n\n pre_aggregations:\n # Pre-aggregation definitions go here.\n # Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started\n\n" ,
264- language : 'yaml' ,
264+ export const EmptyLineDiff = {
265+ render : Template ,
266+ args : {
267+ modified :
268+ "cubes:\n - name: orders\n sql: >\n select 1 as id, 100 as amount, 'new' status\n UNION ALL\n select 2 as id, 200 as amount, 'new' status\n UNION ALL\n select 3 as id, 300 as amount, 'processed' status\n UNION ALL\n select 4 as id, 500 as amount, 'processed' status\n UNION ALL\n select 5 as id, 600 as amount, 'shipped' status\n\n joins: []\n\n dimensions:\n - name: id\n type: number\n\n - name: status\n sql: status\n\n\n measures:\n - name: count\n type: count\n\n - name: amount\n sql: amount\n type: sum\n\n pre_aggregations:\n # Pre-aggregation definitions go here.\n # Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started\n\n" ,
269+ original :
270+ "cubes:\n - name: orders\n sql: >\n select 1 as id, 100 as amount, 'new' status\n UNION ALL\n select 2 as id, 200 as amount, 'new' status\n UNION ALL\n select 3 as id, 300 as amount, 'processed' status\n UNION ALL\n select 4 as id, 500 as amount, 'processed' status\n UNION ALL\n select 5 as id, 600 as amount, 'shipped' status\n\n joins: []\n\n dimensions:\n - name: id\n\n - name: status\n sql: status\n\n\n measures:\n - name: count\n type: count\n\n - name: amount\n sql: amount\n type: sum\n\n pre_aggregations:\n # Pre-aggregation definitions go here.\n # Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started\n\n" ,
271+ language : 'yaml' ,
272+ } ,
265273} ;
0 commit comments