korbit-ai[bot] commented on code in PR #32729: URL: https://github.com/apache/superset/pull/32729#discussion_r2019103850
########## superset-frontend/src/components/Flex/Flex.stories.tsx: ########## @@ -0,0 +1,86 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Flex, FlexProps } from 'src/components/Flex'; +import { css } from '@superset-ui/core'; + +export default { + title: 'Flex', + component: Flex, +}; + +export const InteractiveFlex = (args: FlexProps) => ( + <Flex + {...args} + css={css` + width: 100%; + height: 90vh; + `} + > + {new Array(20).fill(null).map((_, i) => ( + <p key={i}>Item</p> + ))} + </Flex> +); + +InteractiveFlex.args = { + vertical: false, + wrap: 'nowrap', + justify: 'normal', + align: 'normal', + flex: 'normal', + gap: 'small', +}; + +InteractiveFlex.argTypes = { + vertical: { + control: { type: 'boolean' }, + type: { name: 'boolean', required: false }, + }, + wrap: { + control: { type: 'select' }, + options: ['nowrap', 'wrap', 'wrap-reverse', false, true], Review Comment: ### Type Inconsistency in Wrap Property Options <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The wrap property options include boolean values (false, true) which are inconsistent with the string type declaration and may cause type conflicts. ###### Why this matters This type mismatch could lead to runtime errors when the component receives boolean values, as the type system expects string values. This contradicts the TypeScript type safety principles. ###### Suggested change ∙ *Feature Preview* Remove the boolean options and keep only string values that match the type declaration: ```typescript options: ['nowrap', 'wrap', 'wrap-reverse'], ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7d1ac8ea-4c3a-4317-87f8-ab1a09d837dc/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7d1ac8ea-4c3a-4317-87f8-ab1a09d837dc?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7d1ac8ea-4c3a-4317-87f8-ab1a09d837dc?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7d1ac8ea-4c3a-4317-87f8-ab1a09d837dc?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/7d1ac8ea-4c3a-4317-87f8-ab1a09d837dc) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:fd3b36e5-aef5-47f1-9d7f-5f04c9858544 --> [](fd3b36e5-aef5-47f1-9d7f-5f04c9858544) ########## superset-frontend/src/components/Flex/Flex.stories.tsx: ########## @@ -0,0 +1,86 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Flex, FlexProps } from 'src/components/Flex'; +import { css } from '@superset-ui/core'; + +export default { + title: 'Flex', + component: Flex, +}; + +export const InteractiveFlex = (args: FlexProps) => ( + <Flex + {...args} + css={css` + width: 100%; + height: 90vh; + `} + > + {new Array(20).fill(null).map((_, i) => ( + <p key={i}>Item</p> + ))} Review Comment: ### Non-configurable demo items in story <sub></sub> <details> <summary>Tell me more</summary> ###### What is the issue? The story component uses hardcoded array creation with map for demonstration items rather than making the items configurable through story args. ###### Why this matters This reduces the reusability and flexibility of the story component for testing different scenarios. It violates the Open-Closed Principle by not allowing extension without modification. ###### Suggested change ∙ *Feature Preview* Make items configurable through story args: ```typescript export const InteractiveFlex = ({ items = 20, ...args }: FlexProps & { items?: number }) => ( <Flex {...args}> {Array.from({ length: items }, (_, i) => ( <p key={i}>Item {i + 1}</p> ))} </Flex> ); InteractiveFlex.args = { items: 20, // ... other args }; ``` ###### Provide feedback to improve future suggestions [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bc8c18fb-344b-445e-9d44-6263a1f9fb35/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bc8c18fb-344b-445e-9d44-6263a1f9fb35?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bc8c18fb-344b-445e-9d44-6263a1f9fb35?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bc8c18fb-344b-445e-9d44-6263a1f9fb35?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/bc8c18fb-344b-445e-9d44-6263a1f9fb35) </details> <sub> 💬 Looking for more details? Reply to this comment to chat with Korbit. </sub> <!--- korbi internal id:c0570da8-064d-49f4-9834-8f314f7a40c1 --> [](c0570da8-064d-49f4-9834-8f314f7a40c1) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
