-
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 #47 from atomicjolt/sc/button-cleanup
Button Refactor / Cleanup
- Loading branch information
Showing
29 changed files
with
375 additions
and
430 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 |
---|---|---|
|
@@ -16,5 +16,6 @@ docs/build | |
dist | ||
node_modules | ||
packages/atomic-fuel/libs | ||
.vscode | ||
|
||
|
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
4 changes: 2 additions & 2 deletions
4
packages/atomic-elements/src/components/Buttons/Button/Button.context.ts
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import React from "react"; | ||
import { ButtonProps } from "."; | ||
import { IconButtonProps } from "../IconButton"; | ||
import { createComponentContext } from "@utils/index"; | ||
import { HasIcon } from '../../../types'; | ||
|
||
export const ButtonContext = createComponentContext< | ||
ButtonProps & IconButtonProps | ||
ButtonProps & HasIcon | ||
>(); |
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
130 changes: 128 additions & 2 deletions
130
packages/atomic-elements/src/components/Buttons/Button/Button.styles.ts
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 |
---|---|---|
@@ -1,7 +1,133 @@ | ||
import styled from "styled-components"; | ||
import { BaseStyledButton } from "../Buttons.styles"; | ||
import mixins from "@styles/mixins"; | ||
|
||
export const StyledButton = styled(BaseStyledButton)` | ||
export const StyledButton = styled.button` | ||
${mixins.SizingX} | ||
${mixins.Bold} | ||
${mixins.FocusVisible(2)} | ||
padding: var(--btn-padding-vert) var(--btn-padding-horiz); | ||
border-radius: var(--btn-border-radius); | ||
font-size: var(--btn-font-size); | ||
min-height: var(--btn-height); | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: var(--btn-icon-gap); | ||
text-decoration: none; | ||
transition: | ||
background 100ms ease, | ||
color 100ms ease, | ||
transform 100ms ease, | ||
box-shadow 100ms ease; | ||
color: var(--btn-text-clr); | ||
background-color: var(--btn-bg-clr); | ||
border: var(--btn-border, none); | ||
box-shadow: var(--btn-shadow, none); | ||
--loader-clr: var(--btn-text-clr); | ||
&:hover { | ||
cursor: pointer; | ||
color: var(--btn-hover-text-clr); | ||
background-color: var(--btn-hover-bg-clr); | ||
box-shadow: var(--btn-hover-shadow); | ||
} | ||
&:disabled { | ||
opacity: 0.5; | ||
pointer-events: none; | ||
} | ||
&[data-pressed] { | ||
transform: var(--btn-pressed-transform); | ||
} | ||
&[data-loading] { | ||
position: relative; | ||
color: transparent; | ||
.aje-spinner, | ||
.aje-three-dot-loader { | ||
--loader-clr: var(--btn-text-clr); | ||
--loader-size: 1em; | ||
} | ||
} | ||
&.aje-btn--primary { | ||
--btn-text-clr: var(--text-clr-inverted); | ||
--btn-bg-clr: var(--accent-clr); | ||
--btn-hover-text-clr: var(--btn-text-clr); | ||
--btn-hover-bg-clr: var(--accent-clr-alt); | ||
} | ||
&.aje-btn--secondary { | ||
--btn-text-clr: var(--text-clr-alt); | ||
--btn-bg-clr: var(--neutral100); | ||
--btn-hover-text-clr: var(--text-clr); | ||
--btn-hover-bg-clr: var(--neutral200); | ||
--btn-border: var(--border); | ||
} | ||
&.aje-btn--link { | ||
--btn-text-clr: var(--primary700); | ||
--btn-bg-clr: var(--neutral50); | ||
--btn-hover-text-clr: var(--text-clr); | ||
--btn-hover-bg-clr: var(--neutral100); | ||
text-decoration: underline; | ||
} | ||
&.aje-btn--error { | ||
--btn-text-clr: var(--text-clr-inverted); | ||
--btn-bg-clr: var(--error700); | ||
--btn-hover-text-clr: var(--btn-text-clr); | ||
--btn-hover-bg-clr: var(--error800); | ||
} | ||
&.aje-btn--success { | ||
--btn-text-clr: var(--text-clr-inverted); | ||
--btn-bg-clr: var(--success700); | ||
--btn-hover-text-clr: var(--btn-text-clr); | ||
--btn-hover-bg-clr: var(--success800); | ||
} | ||
&.aje-btn--inverted { | ||
--btn-text-clr: var(--text-clr); | ||
--btn-bg-clr: var(--neutral50); | ||
--btn-hover-text-clr: var(--btn-text-clr); | ||
--btn-hover-bg-clr: var(--btn-bg-clr); | ||
--btn-hover-shadow: 0 1px 3px hsla(221, 39%, 11%, 0.5); | ||
} | ||
&.aje-btn--content { | ||
--btn-text-clr: var(--text-clr); | ||
--btn-bg-clr: transparent; | ||
--btn-hover-text-clr: var(--btn-text-clr); | ||
--btn-hover-bg-clr: transparent; | ||
--btn-hover-shadow: none; | ||
--btn-padding-horiz: 0px; | ||
--btn-padding-vert: 0px; | ||
--btn-height: auto; | ||
} | ||
&.aje-btn--border { | ||
--btn-text-clr: var(--text-clr-alt); | ||
--btn-bg-clr: var(--neutral50); | ||
--btn-hover-text-clr: var(--text-clr); | ||
--btn-hover-bg-clr: var(--neutral100); | ||
--btn-border: var(--border); | ||
} | ||
&.aje-btn--ghost { | ||
--btn-text-clr: var(--text-clr-alt); | ||
--btn-bg-clr: transparent; | ||
--btn-hover-text-clr: var(--text-clr); | ||
--btn-hover-bg-clr: var(--neutral100); | ||
--btn-border: transparent; | ||
} | ||
& > i { | ||
color: inherit; | ||
font-size: var(--btn-icon-size); | ||
margin-left: calc(var(--btn-padding-horiz) / -2.5); | ||
} | ||
`; |
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
2 changes: 1 addition & 1 deletion
2
packages/atomic-elements/src/components/Buttons/Button/index.tsx
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { Button } from "./Button.component"; | ||
export type { ButtonProps } from "./Button.component"; | ||
export type { ButtonProps, ButtonVariants } from "./Button.component"; |
Oops, something went wrong.