-
Couldn't load subscription status.
- Fork 0
InNumbers component interface #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -278,6 +278,15 @@ export declare namespace ContentTree { | |||||
| /** Configuration data to be passed to the component. */ | ||||||
| attributes: CustomCodeComponentAttributes; | ||||||
| } | ||||||
| interface InNumbersNumber extends Node { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We agreed with @adgad to use BigNumber instead of this (FE may need to be reviewed because styles used by big number) |
||||||
| type: "in-numbers-number"; | ||||||
| numberLabel: string; | ||||||
| description: string; | ||||||
| } | ||||||
| interface InNumbers extends Parent { | ||||||
| type: "in-numbers"; | ||||||
| children: [Heading, InNumbersNumber, InNumbersNumber?, InNumbersNumber?]; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heading it's not mandatory and we need to support ImageSet
Suggested change
|
||||||
| } | ||||||
| namespace full { | ||||||
| type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text; | ||||||
| type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; | ||||||
|
|
@@ -558,6 +567,15 @@ export declare namespace ContentTree { | |||||
| /** Configuration data to be passed to the component. */ | ||||||
| attributes: CustomCodeComponentAttributes; | ||||||
| } | ||||||
| interface InNumbersNumber extends Node { | ||||||
| type: "in-numbers-number"; | ||||||
| numberLabel: string; | ||||||
| description: string; | ||||||
| } | ||||||
| interface InNumbers extends Parent { | ||||||
| type: "in-numbers"; | ||||||
| children: [Heading, InNumbersNumber, InNumbersNumber?, InNumbersNumber?]; | ||||||
| } | ||||||
| } | ||||||
| namespace transit { | ||||||
| type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text; | ||||||
|
|
@@ -824,6 +842,15 @@ export declare namespace ContentTree { | |||||
| /** How the component should be presented in the article page according to the column layout system */ | ||||||
| layoutWidth: LayoutWidth; | ||||||
| } | ||||||
| interface InNumbersNumber extends Node { | ||||||
| type: "in-numbers-number"; | ||||||
| numberLabel: string; | ||||||
| description: string; | ||||||
| } | ||||||
| interface InNumbers extends Parent { | ||||||
| type: "in-numbers"; | ||||||
| children: [Heading, InNumbersNumber, InNumbersNumber?, InNumbersNumber?]; | ||||||
| } | ||||||
| } | ||||||
| namespace loose { | ||||||
| type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text; | ||||||
|
|
@@ -1105,5 +1132,14 @@ export declare namespace ContentTree { | |||||
| /** Configuration data to be passed to the component. */ | ||||||
| attributes?: CustomCodeComponentAttributes; | ||||||
| } | ||||||
| interface InNumbersNumber extends Node { | ||||||
| type: "in-numbers-number"; | ||||||
| numberLabel: string; | ||||||
| description: string; | ||||||
| } | ||||||
| interface InNumbers extends Parent { | ||||||
| type: "in-numbers"; | ||||||
| children: [Heading, InNumbersNumber, InNumbersNumber?, InNumbersNumber?]; | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep the field name consistent with
BigNumber?(Incidentally I was wondering if it should be a
numberrather thanstring, but looks like BigNumber is also astring!)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of using numberLabel is because I was leaving
numberavailable in case one day we will have a propernumber: number, similarly to here we may have adate: Date.If we want to communicate consistency/relations perhaps we should do this:
but I wonder if this become a slippery slope towards some kind of
coupling hellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adgad On second thought, the likelihood to need a number as number seems very low, so we can go with your suggestion and same perhaps for the
datein the Timeline PR. At then end, as UI representation, the need of have better types it's small. In the long term though we may have issue to automatically associate for instance a datePicker in Spark to a field that is a string instead of a proper date, that kind of problems.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I guess because we haven't had any validation till now in the CMS, it's very likely that we have existing timeline dates that aren't dates, big numbers that aren't numbers etc.
yeah i can see this being useful with schema-generated components in the future, and being able to have validation in the CMS as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. The options are:
numberas a string in the new In Numbers component and usedateas a string in the new Timeline componentnumberasnumberanddateasDateand we may end-up in even more confusing choices likenumberAsNumber: numberlabelfor fields that are free string, Editorial can really put whatever they want thereIMO and this is also for @elpopova and @todor-videv1 perhaps, part of this topic is about which future do we see for the Content Tree as a document? Is it just for a UI with a bunch of strings or shall it evolve to something that machine should better understand too. I'm raising it because this is in some form related too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would keeping it to a generic thing like
valuehelp for future modelling for simple types (as opposed to data structures)? e.g. Number.value, SimpleThing.value. Or a bit more specific liketextfor strings.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @debugwand. I think this is a very good suggestion. It's already applied for Text here.
Potentially, we could use
valueand not having a breaking change even if we move towards what I mentioned hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, we could have something like...
... but we may not get any particular value to tight to a single
Numbernode at this stage, perhaps we can keep them separated as they are in this PR and usevaluethat will still permit us in the future to merge the types without a breaking change if we desire to do so