-
Notifications
You must be signed in to change notification settings - Fork 26
Step one component #75
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: debugger-steps-component
Are you sure you want to change the base?
Changes from all commits
801751b
6babb6d
0578962
5a0968b
857b3de
af596d5
7a79f5b
6e7d5ca
8f93648
f69e6cf
725a795
7e40313
220d995
6d8ee46
79f0f89
4457ce7
cb47ea2
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { ArrowIcon } from "features/common/icons/arrow.icon"; | ||
| import styles from "./button.module.scss"; | ||
|
|
||
| export const Button = ({ | ||
| label, | ||
| onClick, | ||
| }: { | ||
| label: string; | ||
| onClick?: () => void; | ||
| }) => { | ||
| return ( | ||
| <button className={styles.button} onClick={onClick}> | ||
| {label} | ||
| <div className={styles.button_arrow}> | ||
| <ArrowIcon /> | ||
| </div> | ||
| </button> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| @use "libs/theme/styles/variables" as *; | ||
| @use "libs/theme/styles/mixins" as *; | ||
|
|
||
| .button { | ||
| display: flex; | ||
| padding: 0.75rem 2rem; | ||
| justify-content: center; | ||
| align-items: center; | ||
| gap: 0.5rem; | ||
| align-self: stretch; | ||
| border-radius: 0.375rem; | ||
| font-size: 1rem; | ||
| line-height: 1.5rem; | ||
| font-style: normal; | ||
| font-weight: 500; | ||
| letter-spacing: 0.2px; | ||
| background-color: var(--sky); | ||
| color: $color_fg_on_button_primary; | ||
| border: 0px; | ||
| cursor: pointer; | ||
|
|
||
| @media #{$breakpoint-dimension-sm} { | ||
| width: fit-content; | ||
| margin: auto; | ||
| } | ||
| } | ||
|
|
||
| .button_arrow { | ||
| flex-shrink: 0; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| height: 0.75rem; | ||
| width: 0.75rem; | ||
| border: 0; | ||
|
|
||
| svg { | ||
| height: 0.75rem; | ||
| width: 0.75rem; | ||
|
|
||
| path { | ||
| fill: $color_fg_on_button_primary; | ||
| } | ||
| } | ||
|
|
||
| @media #{$breakpoint-dimension-sm} { | ||
| height: 1rem; | ||
| width: 1rem; | ||
|
|
||
| svg { | ||
| height: 0.875rem; | ||
| width: 0.875rem; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| export const ArrowIcon = () => { | ||
| return ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="18" | ||
| height="18" | ||
| viewBox="0 0 18 18" | ||
| fill="none" | ||
| > | ||
| <path | ||
| d="M10.8242 4.44727L15.3767 8.99977L10.8242 13.5523" | ||
| stroke="white" | ||
| strokeWidth="1.5" | ||
| strokeMiterlimit="10" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| d="M2.625 9H15.2475" | ||
| stroke="white" | ||
| strokeWidth="1.5" | ||
| strokeMiterlimit="10" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </svg> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import styles from "./codeblock.module.scss"; | ||
|
|
||
| export type RequestData = { | ||
| url: string; | ||
| params: { | ||
| key: string; | ||
| value: string; | ||
| isEditable?: boolean; | ||
| }[]; | ||
| }; | ||
| interface CodeBlockProps { | ||
| title: string; | ||
| type: "request" | "json"; | ||
|
Contributor
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. "json" does not seem to be implemented, might be in a future PR? |
||
| requestData?: RequestData; | ||
| } | ||
|
|
||
| export const Codeblock = (props: CodeBlockProps) => { | ||
| const { title, type, requestData } = props; | ||
| return ( | ||
| <div className={styles.scroll_container}> | ||
| <div className={styles.container}> | ||
| <div className={styles.title_container}>{title}</div> | ||
| <div className={styles.code_block}> | ||
| {type === "request" && requestData ? ( | ||
| <> | ||
| <div className={styles.code_line}> | ||
| <p className={styles.code_line_number}>01</p> | ||
| <p className={styles.param_value} data-editable={"true"}> | ||
| <span>{`${requestData.url}?`}</span> | ||
| </p> | ||
| </div> | ||
| {requestData.params.map((data, idx) => ( | ||
| <div key={idx} className={styles.code_line}> | ||
| <p className={styles.code_line_number}>{`0${idx + 2}`}</p> | ||
|
Contributor
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. Is a request always going to be less than 9 lines? Otherwise, this line numbering will break, eg, Implementing a helper function that adds padding might be a better solution: (This will again break with |
||
| <p | ||
| className={styles.param_value} | ||
| data-editable={data.isEditable ? "true" : "false"} | ||
| > | ||
| {`${idx > 0 ? "&" : ""}${data.key}=`} | ||
| <span>{data.value}</span> | ||
| </p> | ||
| </div> | ||
| ))} | ||
| </> | ||
| ) : null} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| @use "libs/theme/styles/variables" as *; | ||
| @use "libs/theme/styles/mixins" as *; | ||
|
|
||
|
|
||
| .scroll_container { | ||
| overflow-x: auto; | ||
| overflow-y: hidden; | ||
| max-width: 100%; | ||
| } | ||
| .container { | ||
| width: 544px; | ||
| border: 0.5px solid var(--color_border_light); | ||
| background-color: var(--color_bg_light); | ||
| } | ||
|
|
||
| .title_container { | ||
| padding: 24px; | ||
| color: var(--color_fg_bold); | ||
| text-transform: uppercase; | ||
| font-size: 14px; | ||
| font-weight: 500; | ||
| line-height: 20px; | ||
| border-bottom: 0.5px solid var(--color_border_light); | ||
| } | ||
|
|
||
| .code_block { | ||
| color: var(--color_fg_link); | ||
| font-feature-settings: 'liga' off, 'clig' off; | ||
| font-family: "Roboto Mono"; | ||
|
Contributor
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. Use |
||
| font-size: 14px; | ||
| font-style: normal; | ||
| font-weight: 400; | ||
| line-height: 32px; | ||
| letter-spacing: 0.15px; | ||
| margin-left: 1.5rem; | ||
| padding: 1.5rem 0; | ||
| } | ||
|
|
||
| .code_line { | ||
| display: flex; | ||
| &:first-child { | ||
| gap: 1rem; | ||
| } | ||
| &:not(:first-child) { | ||
| gap: 2rem; | ||
| } | ||
| } | ||
|
|
||
| .code_line_number { | ||
| color: var(--functional-gray-550); | ||
| } | ||
|
|
||
| .param_value { | ||
| &[data-editable="true"] span{ | ||
| border: 1px solid var(--seafoam); | ||
| padding: 0 0.5rem; | ||
| cursor: pointer; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,40 @@ | ||
| import { Button } from "features/common/components/button/button.component"; | ||
| import { Codeblock, RequestData } from "../../codeblock/codeblock.component"; | ||
|
|
||
| //TODO: replace with actual data coming from local state and api endpoint | ||
| const REQUEST_DATA: RequestData = { | ||
| url: "https://samples.auth0.com/authorize", | ||
| params: [ | ||
| { | ||
| key: "client_id", | ||
| value: "testvalue1234456677888", | ||
| isEditable: true, | ||
| }, | ||
| { | ||
| key: "redirect_uri", | ||
| value: "https://openidconnect.net/callback", | ||
| }, | ||
| { | ||
| key: "scope", | ||
| value: "openid profile email phone address", | ||
| isEditable: true, | ||
| }, | ||
| { | ||
| key: "response_type", | ||
| value: "code" | ||
| }, | ||
| { | ||
| key: "state", | ||
| value: "12345678909876543212" | ||
| } | ||
| ], | ||
| }; | ||
|
|
||
| export const StepOne = () => { | ||
| return <p>Step One</p> | ||
| } | ||
| return ( | ||
| <> | ||
| <Codeblock title="Request" type="request" requestData={REQUEST_DATA} /> | ||
| <Button label="Start" /> | ||
| </> | ||
| ); | ||
| }; |
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.
add
type="button"as this is not used to submit a form