-
Notifications
You must be signed in to change notification settings - Fork 2
Add Button, IconButton and Select component #544
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
Merged
kshmidt-digma
merged 3 commits into
feature/navigation
from
feature/highlight-in-editor
Feb 27, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/components/Insights/common/InsightCard/IconButton/IconButton.stories.tsx
This file contains hidden or 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 { Meta, StoryObj } from "@storybook/react"; | ||
| import { IconButton } from "."; | ||
| import { JiraLogoIcon } from "../../../../common/icons/16px/JiraLogoIcon"; | ||
|
|
||
| // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction | ||
| const meta: Meta<typeof IconButton> = { | ||
| title: "Insights/common/InsightCard/IconButton", | ||
| component: IconButton, | ||
| parameters: { | ||
| // More on how to position stories at: https://storybook.js.org/docs/react/configure/story-layout | ||
| layout: "fullscreen" | ||
| } | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const Default: Story = { | ||
| args: { | ||
| icon: { | ||
| component: JiraLogoIcon | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| export const Disabled: Story = { | ||
| args: { | ||
| icon: { | ||
| component: JiraLogoIcon | ||
| }, | ||
| isDisabled: true | ||
| } | ||
| }; |
22 changes: 22 additions & 0 deletions
22
src/components/Insights/common/InsightCard/IconButton/index.tsx
This file contains hidden or 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,22 @@ | ||
| import { ForwardedRef, forwardRef } from "react"; | ||
| import * as s from "./styles"; | ||
| import { IconButtonProps } from "./types"; | ||
|
|
||
| export const IconButtonComponent = ( | ||
| props: IconButtonProps, | ||
| ref: ForwardedRef<HTMLButtonElement> | ||
| ) => ( | ||
| <s.Button | ||
| ref={ref} | ||
| disabled={props.isDisabled} | ||
| onClick={props.onClick} | ||
| className={props.className} | ||
| > | ||
| <props.icon.component | ||
| size={props.icon.size || 16} | ||
| color={props.icon.color || "currentColor"} | ||
| /> | ||
| </s.Button> | ||
| ); | ||
|
|
||
| export const IconButton = forwardRef(IconButtonComponent); |
22 changes: 22 additions & 0 deletions
22
src/components/Insights/common/InsightCard/IconButton/styles.ts
This file contains hidden or 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,22 @@ | ||
| import styled from "styled-components"; | ||
|
|
||
| export const Button = styled.button` | ||
| display: flex; | ||
| border-radius: 2px; | ||
| margin: 0; | ||
| cursor: pointer; | ||
| padding: 4px; | ||
| border: none; | ||
| background: none; | ||
| color: ${({ theme }) => theme.colors.v3.icon.disabled}; | ||
|
|
||
| &:disabled { | ||
| cursor: initial; | ||
| } | ||
|
|
||
| &:hover:enabled, | ||
| &:focus:enabled, | ||
| &:active:enabled { | ||
| background: ${({ theme }) => theme.colors.v3.surface.highlight}; | ||
| } | ||
| `; | ||
14 changes: 14 additions & 0 deletions
14
src/components/Insights/common/InsightCard/IconButton/types.ts
This file contains hidden or 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,14 @@ | ||
| import { ComponentType } from "react"; | ||
| import { IconProps } from "../../../../common/icons/types"; | ||
|
|
||
| export interface IconButtonProps { | ||
| icon: { | ||
| component: ComponentType<IconProps>; | ||
| color?: string; | ||
| size?: number; | ||
| }; | ||
| title?: string; | ||
| onClick?: () => void; | ||
| isDisabled?: boolean; | ||
| className?: string; | ||
| } |
10 changes: 2 additions & 8 deletions
10
src/components/Navigation/CodeButton/AnimatedCodeButton/index.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -1,18 +1,12 @@ | ||
| import { ForwardedRef, forwardRef } from "react"; | ||
| import * as s from "./styles"; | ||
| import { AnimatedCodeButtonProps } from "./types"; | ||
|
|
||
| export const AnimatedCodeButtonComponent = ( | ||
| props: AnimatedCodeButtonProps, | ||
| ref: ForwardedRef<HTMLButtonElement> | ||
| ) => ( | ||
| <s.Button onClick={props.onClick} ref={ref}> | ||
| export const AnimatedCodeButton = (props: AnimatedCodeButtonProps) => ( | ||
| <s.Button onClick={props.onClick}> | ||
| <s.BorderContainer /> | ||
| <s.Background> | ||
| <s.InitialMask /> | ||
| <s.EndMask /> | ||
| </s.Background> | ||
| </s.Button> | ||
| ); | ||
|
|
||
| export const AnimatedCodeButton = forwardRef(AnimatedCodeButtonComponent); |
2 changes: 1 addition & 1 deletion
2
src/components/Navigation/CodeButton/AnimatedCodeButton/types.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export interface AnimatedCodeButtonProps { | ||
| onClick: () => void; | ||
| onClick?: () => void; | ||
| } |
12 changes: 3 additions & 9 deletions
12
src/components/Navigation/CodeButton/GlowingIconButton/index.tsx
This file contains hidden or 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 |
|---|---|---|
| @@ -1,14 +1,8 @@ | ||
| import { ForwardedRef, forwardRef } from "react"; | ||
| import * as s from "./styles"; | ||
| import { GlowingIconButtonProps } from "./types"; | ||
|
|
||
| export const GlowingIconButtonComponent = ( | ||
| props: GlowingIconButtonProps, | ||
| ref: ForwardedRef<HTMLDivElement> | ||
| ) => ( | ||
| <s.BorderContainer $type={props.type} ref={ref}> | ||
| <s.BorderlessIconButton icon={props.icon} onClick={props.onClick} /> | ||
| export const GlowingIconButton = (props: GlowingIconButtonProps) => ( | ||
| <s.BorderContainer $type={props.type} onClick={props.onClick}> | ||
| <s.BorderlessIconButton icon={props.icon} /> | ||
| </s.BorderContainer> | ||
| ); | ||
|
|
||
| export const GlowingIconButton = forwardRef(GlowingIconButtonComponent); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.