-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from NASA-PDS/search-page-components
Add search page components
- Loading branch information
Showing
12 changed files
with
172 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@use "@nasapds/wds/css/button.css"; | ||
|
||
.MuiButtonBase-root.MuiButton-root{ | ||
&.wds-button-cta { | ||
box-shadow: none; | ||
@extend .wds-button-cta; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { StoryObj, Meta } from "@storybook/react"; | ||
import { TextField } from "./Button"; | ||
|
||
export default { | ||
component: TextField, | ||
} as Meta<typeof TextField>; | ||
type Story = StoryObj<typeof TextField>; | ||
|
||
export const Default: Story = { | ||
args: {}, | ||
}; | ||
|
||
export const Placeholder: Story = { | ||
args: { | ||
placeholder: "placeholder", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import renderer from "react-test-renderer"; | ||
import { describe, expect, test } from "vitest"; | ||
import { TextField } from "./Button"; | ||
|
||
describe("TextField", () => { | ||
test("TextField component renders correctly", () => { | ||
const component = renderer.create(<TextField />); | ||
|
||
const tree = component.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test("The label prop works", () => { | ||
const component = renderer.create(<TextField />); | ||
|
||
const tree = component.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import MaterialButton from "@mui/material/Button"; | ||
import { ButtonProps as MuiBottonProps } from "@mui/material/Button"; | ||
|
||
type PdsButtonProps = { | ||
variant: "cta"; | ||
}; | ||
|
||
export type ButtonProps = PdsButtonProps & Omit<MuiBottonProps, "variant">; | ||
|
||
export const Button = (props: ButtonProps) => { | ||
const { variant, className, ...other } = props; | ||
|
||
let buttonClass = ""; | ||
let muiVariant; | ||
|
||
if (className) { | ||
buttonClass = className + " wds-button"; | ||
} else { | ||
buttonClass = "wds-button"; | ||
} | ||
|
||
switch (variant) { | ||
case "cta": | ||
buttonClass += "-cta"; | ||
muiVariant = "contained" as const; | ||
break; | ||
default: | ||
muiVariant = "text" as const; | ||
} | ||
|
||
return ( | ||
<MaterialButton className={buttonClass} variant={muiVariant} {...other} /> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./Button"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.pds-wds-react-textfield .MuiInputBase-root{ | ||
padding: 0 16px 0 16px; | ||
} | ||
|
||
.pds-wds-react-textfield .MuiOutlinedInput-notchedOutline { | ||
border-color: var(--pds-secondary-white-s2); | ||
border-radius: 2px; | ||
} | ||
|
||
.pds-wds-react-textfield .MuiInputBase-input.MuiOutlinedInput-input{ | ||
color: var(--pds-secondary-black-t2); | ||
padding: 16px 0 16px 10px; | ||
} | ||
|
||
.pds-wds-react-textfield .MuiInputBase-root:hover .MuiOutlinedInput-notchedOutline{ | ||
border-color: var(--pds-secondary-white-s4); | ||
} | ||
|
||
.pds-wds-react-textfield .MuiInputBase-root.Mui-focused{ | ||
border-color: var(--pds-primary-blue); | ||
} | ||
|
||
.pds-wds-react-textfield .MuiInputBase-root.Mui-focused:hover .MuiOutlinedInput-notchedOutline{ | ||
border-color: var(--pds-primary-blue); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters