-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix typescript compilation errors on all presentational components #385
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.action-story-primary { | ||
background-color: rosybrown; | ||
background-color: var(--mdhui-color-primary); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,49 @@ | ||
import React from "react"; | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import Action, { ActionProps } from "./Action"; | ||
import Layout from "../Layout" | ||
import Layout from "../Layout"; | ||
import './Action.stories.css'; | ||
import { FontAwesomeSvgIcon } from "react-fontawesome-svg-icon"; | ||
import { faFile } from "@fortawesome/free-solid-svg-icons"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
export default { | ||
const meta: Meta<typeof Action> = { | ||
title: "Presentational/Action", | ||
component: Action, | ||
parameters: { | ||
layout: 'fullscreen', | ||
layout: 'fullscreen' | ||
} | ||
} as ComponentMeta<typeof Action>; | ||
}; | ||
|
||
const Template: ComponentStory<typeof Action> = (args: ActionProps) => | ||
export default meta; | ||
type Story = StoryObj<typeof Action>; | ||
|
||
const render = (args: ActionProps) => | ||
<Layout colorScheme="auto"> | ||
<Action {...args} /> | ||
</Layout>; | ||
|
||
export const StartSurvey = Template.bind({}); | ||
StartSurvey.args = { | ||
const baseArgs : ActionProps = { | ||
title: "Baseline Survey", | ||
subtitle: "Tap here to start your baseline survey", | ||
onClick: () => alert("Clicked") | ||
}; | ||
|
||
export const WithClickEvent: Story = { | ||
args: {...baseArgs}, | ||
render: render | ||
} | ||
|
||
export const WithClass = Template.bind({}); | ||
WithClass.args = { | ||
title: "Baseline Survey", | ||
subtitle: "Tap here to start your baseline survey", | ||
className: "action-story-primary", | ||
onClick: () => alert("Clicked") | ||
export const WithClass: Story = { | ||
args: {...baseArgs, className: "action-story-primary", renderAs: "div"}, | ||
render: render | ||
} | ||
|
||
export const WithIcon = Template.bind({}); | ||
WithIcon.args = { | ||
title: "Baseline Survey", | ||
subtitle: "Tap here to start your baseline survey", | ||
icon: <FontAwesomeSvgIcon icon={faFile} color="#2e6e9e" />, | ||
onClick: () => alert("Clicked") | ||
export const WithIcon: Story = { | ||
args: {...baseArgs, icon: <FontAwesomeSvgIcon icon={faFile} color="#2e6e9e" />}, | ||
render: render | ||
} | ||
|
||
export const WithTitleIcon = Template.bind({}); | ||
WithTitleIcon.args = { | ||
titleIcon: <span><FontAwesomeSvgIcon icon={faFile} color="#2e6e9e" /> </span>, | ||
title: "Baseline Survey", | ||
subtitle: "Tap here to start your baseline survey", | ||
onClick: () => alert("Clicked") | ||
export const WithTitleIcon: Story = { | ||
args: {...baseArgs, titleIcon: <FontAwesomeSvgIcon icon={faFile} color="#2e6e9e" />}, | ||
render: render | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,12 +19,12 @@ export interface ButtonProps { | |
fullWidth?: boolean; | ||
} | ||
|
||
export default function (props: ButtonProps) { | ||
export default function Button(props: ButtonProps) { | ||
let classes = ["mdhui-button"]; | ||
if (props.className) { | ||
classes.push(props.className); | ||
} | ||
if(props.fullWidth ?? true){ | ||
if (props.fullWidth ?? true) { | ||
classes.push("mdhui-button-full-width"); | ||
} | ||
Comment on lines
+27
to
29
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. 💡 Codebase verification 🛠️ Refactor suggestion Confirmed: Button's fullWidth prop needs correction The current implementation ( -if (props.fullWidth ?? true) {
+if (props.fullWidth) { This change will:
🔗 Analysis chainReview the default fullWidth behavior. The current implementation
Let's check the existing usage to understand the impact: Consider changing to: -if (props.fullWidth ?? true) {
+if (props.fullWidth) { 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for Button component usage with fullWidth prop
rg "fullWidth[=:]" --type ts --type tsx
Length of output: 69 Script: #!/bin/bash
# Search for Button component usage and type definitions
rg "fullWidth" -t ts -t typescript -t jsx -t tsx
# Search for Button component definitions and usage patterns
ast-grep --pattern 'interface ButtonProps {
$$$
}'
# Search for Button usage in JSX
ast-grep --pattern '<Button
$$$
/>'
Length of output: 1159 Script: #!/bin/bash
# Search for any Button component imports and usages
rg "Button" -t js -t jsx -t ts
# Try finding Button usages with component pattern
ast-grep --pattern 'Button $$$'
Length of output: 92 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. Need to leave as is for now 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. @reneefromhold Understood, I'll respect your decision to keep the current behavior. Would you like me to create a GitHub issue to track this as a potential future improvement? |
||
if (props.defaultMargin) { | ||
|
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.
🛠️ Refactor suggestion
Maintain consistency in icon color usage
For consistency with the previous story, the titleIcon should use the same color approach.
📝 Committable suggestion