diff --git a/apps/cyberstorm-remix/app/communities/SearchAndOrder.module.css b/apps/cyberstorm-remix/app/communities/SearchAndOrder.module.css index 8c812e592..95802ab56 100644 --- a/apps/cyberstorm-remix/app/communities/SearchAndOrder.module.css +++ b/apps/cyberstorm-remix/app/communities/SearchAndOrder.module.css @@ -3,6 +3,7 @@ flex-direction: row; gap: var(--gap--16); justify-content: space-between; + color: var(--color-tertiary); } .searchTextInput { diff --git a/apps/cyberstorm-remix/app/communities/communities.tsx b/apps/cyberstorm-remix/app/communities/communities.tsx index 69b5a636c..82164ca79 100644 --- a/apps/cyberstorm-remix/app/communities/communities.tsx +++ b/apps/cyberstorm-remix/app/communities/communities.tsx @@ -1,6 +1,5 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { - Container, CardCommunity, CommunityCardSkeleton, EmptyState, @@ -30,6 +29,7 @@ import { } from "@remix-run/react"; import { Communities } from "@thunderstore/dapper/types"; import { getDapper } from "cyberstorm/dapper/sessionUtils"; +import { classnames } from "@thunderstore/cyberstorm/src/utils/utils"; export const meta: MetaFunction = () => { return [ @@ -131,20 +131,18 @@ export default function CommunitiesPage() { Communities
- + Communities
-
@@ -154,7 +152,6 @@ export default function CommunitiesPage() { placeholder="Search communities..." clearValue={() => setSearchValue("")} leftIcon={} - csColor="cyber-green" id="communitiesSearchInput" />
@@ -168,7 +165,7 @@ export default function CommunitiesPage() { id="communitiesSortBy" /> -
+ {/* {navigation.state === "loading" ? ( diff --git a/apps/cyberstorm-remix/app/root.tsx b/apps/cyberstorm-remix/app/root.tsx index 4638dc51f..023709ea1 100644 --- a/apps/cyberstorm-remix/app/root.tsx +++ b/apps/cyberstorm-remix/app/root.tsx @@ -1,4 +1,5 @@ import "@thunderstore/cyberstorm-styles"; +import "@thunderstore/cyberstorm-theme"; import "./styles/index.css"; import { Links, diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/DesktopLoginPopover.tsx b/apps/cyberstorm-remix/cyberstorm/navigation/DesktopLoginPopover.tsx index c4d9823c9..24171e197 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/DesktopLoginPopover.tsx +++ b/apps/cyberstorm-remix/cyberstorm/navigation/DesktopLoginPopover.tsx @@ -21,14 +21,12 @@ export function DesktopLoginPopover() { trigger={ @@ -67,7 +65,7 @@ export function DesktopLoginPopover() { Log in to Thunderstore diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.module.css b/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.module.css index cf4cb83bc..97d70175e 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.module.css +++ b/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.module.css @@ -2,6 +2,7 @@ display: flex; align-items: center; justify-content: space-between; + color: var(--color-primary); } .focus:not([data-highlighted]) a svg { @@ -11,3 +12,7 @@ .root { min-width: 14rem; } + +.link { + color: var(--color-primary); +} diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.tsx b/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.tsx index cfabcafcf..32e6b118d 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.tsx +++ b/apps/cyberstorm-remix/cyberstorm/navigation/DevelopersDropDown.tsx @@ -10,28 +10,34 @@ import { NewButton, NewLink, } from "@thunderstore/cyberstorm"; +import { classnames } from "@thunderstore/cyberstorm/src/utils/utils"; export function DevelopersDropDown() { return ( <> + Developers } - csVariant="default" - csColor="surface" rootClasses={styles.root} > API Docs @@ -40,8 +46,11 @@ export function DevelopersDropDown() { Package Format Docs @@ -50,8 +59,11 @@ export function DevelopersDropDown() { Manifest Validator @@ -60,8 +72,11 @@ export function DevelopersDropDown() { Markdown Preview @@ -70,10 +85,12 @@ export function DevelopersDropDown() { Github diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/LoginList.tsx b/apps/cyberstorm-remix/cyberstorm/navigation/LoginList.tsx index 4d5f7657e..46c21b034 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/LoginList.tsx +++ b/apps/cyberstorm-remix/cyberstorm/navigation/LoginList.tsx @@ -39,7 +39,7 @@ export function LoginList() { Log in to Thunderstore diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/MobileUserPopoverContent.tsx b/apps/cyberstorm-remix/cyberstorm/navigation/MobileUserPopoverContent.tsx index 53bcf1bda..c7c0c06d7 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/MobileUserPopoverContent.tsx +++ b/apps/cyberstorm-remix/cyberstorm/navigation/MobileUserPopoverContent.tsx @@ -44,8 +44,9 @@ export function MobileUserPopoverContent(props: { user: CurrentUser }) { }} aria-label="Back" mode="iconButton" - csSize="m" - csVariant="tertiaryDimmed" + csSize="medium" + csVariant="secondary" + csModifiers={["subtle", "dimmed"]} icon={faLongArrowLeft} /> } diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.module.css b/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.module.css index 134d647a1..5695f6ee2 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.module.css +++ b/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.module.css @@ -36,6 +36,11 @@ width: 1.655rem; height: 1.463rem; margin: 0 0.75rem; + color: var(--color-cyber-green--7); +} + +.logoWrapper:hover { + color: var(--color-cyber-green--9); } .dropDownItem { @@ -71,12 +76,12 @@ align-items: center; align-self: stretch; justify-content: space-between; - color: var(--color-primary); background: transparent; } .mobileNavMenuDevelopersButtonIcon { height: 0.875rem; + color: var(--color-tertiary); } .mobileNavItem { @@ -112,6 +117,7 @@ button.mobileNavItem { align-items: center; align-self: stretch; padding: 1rem; + color: var(--color-primary); } .accountPopoverUser { @@ -209,6 +215,10 @@ button.mobileNavItem { --text-color: #8683be; } +.loginLegalTextLinks { + color: var(--color-tertiary); +} + .mobileMenu { display: none; } @@ -238,12 +248,15 @@ button.mobileNavItem { } .getAppButton { + height: 2.25rem; padding: 0.75rem 0.812rem; } .loginButton { height: 2.25rem !important; padding: 0.75rem !important; + font-weight: var(--font-weight--bold); + font-size: var(--font-size--s); } .headerRightSide { @@ -265,6 +278,7 @@ button.mobileNavItem { align-self: stretch; padding: var(--space--16); border-radius: var(--border-radius--8); + color: var(--color-primary); } .navMenuItem:hover { diff --git a/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.tsx b/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.tsx index 0313c864c..edbee946d 100644 --- a/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.tsx +++ b/apps/cyberstorm-remix/cyberstorm/navigation/Navigation.tsx @@ -48,8 +48,6 @@ export function Navigation(props: { primitiveType="cyberstormLink" linkId="Index" rootClasses={styles.logoWrapper} - csVariant="default" - csColor="cyber-green" aria-label="Home" > @@ -59,9 +57,9 @@ export function Navigation(props: { Communities @@ -71,8 +69,7 @@ export function Navigation(props: { Communities @@ -165,7 +165,6 @@ export function MobileNavigationMenu() { Developers @@ -179,8 +178,9 @@ export function MobileNavigationMenu() { popovertargetaction: "close", }} aria-label="Back to previous menu" - csSize="m" - csVariant="tertiaryDimmed" + csSize="medium" + csVariant="secondary" + csModifiers={["subtle", "dimmed"]} icon={faLongArrowLeft} /> } @@ -189,45 +189,60 @@ export function MobileNavigationMenu() { API Docs GitHub Package Format Docs Markdown Preview Manifest Validator @@ -236,28 +251,37 @@ export function MobileNavigationMenu() {
Contact Us Privacy Policy News @@ -277,8 +301,11 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) {
{user.username} @@ -310,9 +337,12 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) { @@ -351,7 +381,7 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) { Log in to Thunderstore @@ -362,9 +392,10 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) { href={buildAuthLoginUrl({ type: "discord" })} rootClasses={classnames( styles.loginLinkMobile, - styles.loginLinkDiscord + styles.loginLinkDiscord, + "fontSizeS", + "fontWeightBold" )} - csTextStyles={["fontSizeS", "fontWeightBold"]} > @@ -376,9 +407,10 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) { href={buildAuthLoginUrl({ type: "github" })} rootClasses={classnames( styles.loginLinkMobile, - styles.loginLinkGithub + styles.loginLinkGithub, + "fontSizeS", + "fontWeightBold" )} - csTextStyles={["fontSizeS", "fontWeightBold"]} > @@ -390,9 +422,10 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) { href={buildAuthLoginUrl({ type: "overwolf" })} rootClasses={classnames( styles.loginLinkMobile, - styles.loginLinkOverwolf + styles.loginLinkOverwolf, + "fontSizeS", + "fontWeightBold" )} - csTextStyles={["fontSizeS", "fontWeightBold"]} > @@ -401,14 +434,18 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) {
By logging in and accessing the site you agree to{" "} Terms and Conditions {" "} @@ -416,7 +453,7 @@ export function MobileUserPopoverContent(props: { user?: CurrentUser }) { Privacy Policy diff --git a/apps/cyberstorm-storybook/stories/newComponents/Container.stories.tsx b/apps/cyberstorm-storybook/stories/newComponents/Container.stories.tsx deleted file mode 100644 index 62d93e5b5..000000000 --- a/apps/cyberstorm-storybook/stories/newComponents/Container.stories.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { StoryFn, Meta } from "@storybook/react"; -import { Container, NewIcon } from "@thunderstore/cyberstorm"; -import React from "react"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faSearch } from "@fortawesome/free-solid-svg-icons"; - -const meta = { - title: "Container", - component: Container, -} as Meta; - -const Template: StoryFn = () => ( - - - - - Test Style System Check - -); - -const ReferenceContainer = Template.bind({}); -ReferenceContainer.args = {}; - -export { meta as default, ReferenceContainer }; diff --git a/apps/cyberstorm-storybook/stories/newComponents/Heading.stories.tsx b/apps/cyberstorm-storybook/stories/newComponents/Heading.stories.tsx index ecae009b3..8c96cf2f9 100644 --- a/apps/cyberstorm-storybook/stories/newComponents/Heading.stories.tsx +++ b/apps/cyberstorm-storybook/stories/newComponents/Heading.stories.tsx @@ -19,7 +19,7 @@ const Template: StoryFn = (args) => { {...args} key={`${level}-${styleLevel}`} csLevel={level} - csStyleLevel={styleLevel} + csSize={styleLevel} > Test Heading diff --git a/apps/cyberstorm-storybook/stories/newComponents/TextInput.stories.tsx b/apps/cyberstorm-storybook/stories/newComponents/TextInput.stories.tsx index ad8865393..dc7ede5b2 100644 --- a/apps/cyberstorm-storybook/stories/newComponents/TextInput.stories.tsx +++ b/apps/cyberstorm-storybook/stories/newComponents/TextInput.stories.tsx @@ -22,26 +22,22 @@ ReferenceTextInput.args = {}; const IconTextInput = Template.bind({}); IconTextInput.args = { - csColor: "cyber-green", leftIcon: , }; const PlaceholderTextInput = Template.bind({}); PlaceholderTextInput.args = { - csColor: "cyber-green", placeholder: "Placeholder text", }; const ValueTextInput = Template.bind({}); ValueTextInput.args = { ...defaultArgs, - csColor: "cyber-green", value: "Text value", }; const ValueTextWithClearInput = Template.bind({}); ValueTextWithClearInput.args = { - csColor: "cyber-green", value: "Text value", clearValue: () => { return; @@ -50,7 +46,6 @@ ValueTextWithClearInput.args = { const PlaceholderClearValueLeftIcon = Template.bind({}); PlaceholderClearValueLeftIcon.args = { - csColor: "cyber-green", placeholder: "Placeholder text", clearValue: () => { return; diff --git a/packages/cyberstorm-theme/.gitignore b/packages/cyberstorm-theme/.gitignore new file mode 100644 index 000000000..25562a3d4 --- /dev/null +++ b/packages/cyberstorm-theme/.gitignore @@ -0,0 +1,3 @@ +/node_modules/ +/tsconfig.tsbuildinfo +/dist/ diff --git a/packages/cyberstorm-theme/README.md b/packages/cyberstorm-theme/README.md new file mode 100644 index 000000000..43cdd0120 --- /dev/null +++ b/packages/cyberstorm-theme/README.md @@ -0,0 +1 @@ +To be named "Cyberstorm" as the name "Cyberstorm" was originally meant to be the design system name. diff --git a/packages/cyberstorm-theme/package.json b/packages/cyberstorm-theme/package.json new file mode 100644 index 000000000..8fa9b4f4a --- /dev/null +++ b/packages/cyberstorm-theme/package.json @@ -0,0 +1,13 @@ +{ + "name": "@thunderstore/cyberstorm-theme", + "version": "0.1.0", + "description": "Cyberstorm theme", + "repository": "https://github.com/thunderstore-io/thunderstore-ui/tree/master/packages/cyberstorm-theme", + "type": "module", + "main": "dist/thunderstore-cyberstorm-theme.cjs.js", + "module": "dist/thunderstore-cyberstorm-theme.esm.js", + "types": "dist/thunderstore-cyberstorm-theme.cjs.d.ts", + "files": [ + "dist" + ] +} diff --git a/packages/cyberstorm-theme/src/components.tsx b/packages/cyberstorm-theme/src/components.tsx new file mode 100644 index 000000000..f7d0d41ca --- /dev/null +++ b/packages/cyberstorm-theme/src/components.tsx @@ -0,0 +1,56 @@ +export { + type ButtonVariants, + ButtonVariantsList, + type ButtonSizes, + ButtonSizesList, + type ButtonModifiers, + ButtonModifiersList, +} from "./components/Button/Button"; +export { + type IconButtonVariants, + IconButtonVariantsList, + type IconButtonSizes, + IconButtonSizesList, + type IconButtonModifiers, + IconButtonModifiersList, +} from "./components/Button/IconButton"; +export { + type HeadingVariants, + HeadingVariantsList, + type HeadingSizes, + HeadingSizesList, + type HeadingModifiers, + HeadingModifiersList, +} from "./components/Heading/Heading"; +export { + type DropDownVariants, + DropDownVariantsList, + type DropDownSizes, + DropDownSizesList, + type DropDownModifiers, + DropDownModifiersList, +} from "./components/DropDown/DropDown"; +export { + type DropDownItemVariants, + DropDownItemVariantsList, + type DropDownItemSizes, + DropDownItemSizesList, + type DropDownItemModifiers, + DropDownItemModifiersList, +} from "./components/DropDown/DropDownItem"; +export { + type DropDownDividerVariants, + DropDownDividerVariantsList, + type DropDownDividerSizes, + DropDownDividerSizesList, + type DropDownDividerModifiers, + DropDownDividerModifiersList, +} from "./components/DropDown/DropDownDivider"; +export { + type TextInputVariants, + TextInputVariantsList, + type TextInputSizes, + TextInputSizesList, + type TextInputModifiers, + TextInputModifiersList, +} from "./components/TextInput/TextInput"; diff --git a/packages/cyberstorm-theme/src/components/Button/Button.css b/packages/cyberstorm-theme/src/components/Button/Button.css new file mode 100644 index 000000000..58ba6b1b2 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/Button/Button.css @@ -0,0 +1,261 @@ +/* theme base styles */ +.ts-button { + --button-line-height: var(--line-height--auto); + --button-gap: 1rem; + --button-border-radius: 0.5rem; + + border: var(--button-border); + border-color: var(--button-border-color); + + --button-font-weight: var(--font-weight--bold); +} + +/* MODIFIERS */ +.ts-button:where(.ts-modifier--subtle):where(:not(:hover, :active)) { + --button-background-color: transparent; +} + +.ts-button[disabled] { + opacity: 0.5; + pointer-events: none; +} + +/* SIZES */ +.ts-button:where(.ts-size--xsmall) { + --button-height: var(--space--30); + --button-padding: var(--space--12); + --button-font-size: var(--font-size--xs); +} + +.ts-button:where(.ts-size--small) { + --button-height: var(--space--36); + --button-padding: var(--space--12); + --button-font-size: var(--font-size--s); +} + +.ts-button:where(.ts-size--medium) { + --button-height: var(--space--44); + --button-padding: var(--space--12) var(--space--16); + --button-font-size: var(--font-size--s); +} + +.ts-button:where(.ts-size--big) { + --button-height: var(--space--44); + --button-padding: var(--space--12) var(--space--16); + --button-font-size: var(--font-size--m); +} + +/* VARIANTS */ +.ts-button:where(.ts-variant--primary) { + --button-background-color: var(--button-primary-bg-color--default); + --button-text-color: var(--button-primary-text-color--default); +} + +.ts-button:where(.ts-variant--secondary) { + --button-background-color: var(--button-secondary-bg-color--default); + --button-text-color: var(--button-secondary-text-color--default); +} + +.ts-button:where(.ts-variant--accent) { + --button-background-color: var(--button-accent-bg-color--default); + --button-text-color: var(--button-accent-text-color--default); +} + +.ts-button:where(.ts-variant--special) { + --button-text-color: var(--button-special-text-color--default); + --button-border: var(--button-special-border--default); + + background: var(--button-special-background--default); +} + +.ts-button:where(.ts-variant--success) { + --button-background-color: var(--button-success-bg-color--default); + --button-text-color: var(--button-success-text-color--default); +} + +.ts-button:where(.ts-variant--info) { + --button-background-color: var(--button-info-bg-color--default); + --button-text-color: var(--button-info-text-color--default); +} + +.ts-button:where(.ts-variant--warning) { + --button-background-color: var(--button-warning-bg-color--default); + --button-text-color: var(--button-warning-text-color--default); +} + +.ts-button:where(.ts-variant--danger) { + --button-background-color: var(--button-danger-bg-color--default); + --button-text-color: var(--button-danger-text-color--default); +} + +.ts-button:where(.ts-variant--primary):hover { + --button-background-color: var(--button-primary-bg-color--hover); + --button-text-color: var(--button-primary-text-color--hover); +} + +.ts-button:where(.ts-variant--secondary):hover { + --button-background-color: var(--button-secondary-bg-color--hover); + --button-text-color: var(--button-secondary-text-color--hover); +} + +.ts-button:where(.ts-variant--accent):hover { + --button-background-color: var(--button-accent-bg-color--hover); + --button-text-color: var(--button-accent-text-color--hover); +} + +.ts-button:where(.ts-variant--special):hover { + --button-text-color: var(--button-special-text-color--hover); + --button-border: var(--button-special-border--hover); + + background: var(--button-special-background--hover); +} + +.ts-button:where(.ts-variant--success):hover { + --button-background-color: var(--button-success-bg-color--hover); + --button-text-color: var(--button-success-text-color--hover); +} + +.ts-button:where(.ts-variant--info):hover { + --button-background-color: var(--button-info-bg-color--hover); + --button-text-color: var(--button-info-text-color--hover); +} + +.ts-button:where(.ts-variant--warning):hover { + --button-background-color: var(--button-warning-bg-color--hover); + --button-text-color: var(--button-warning-text-color--hover); +} + +.ts-button:where(.ts-variant--danger):hover { + --button-background-color: var(--button-danger-bg-color--hover); + --button-text-color: var(--button-danger-text-color--hover); +} + +.ts-button:where(.ts-variant--primary):active { + --button-background-color: var(--button-primary-bg-color--active); + --button-text-color: var(--button-primary-text-color--active); +} + +.ts-button:where(.ts-variant--secondary):active { + --button-background-color: var(--button-secondary-bg-color--active); + --button-text-color: var(--button-secondary-text-color--active); +} + +.ts-button:where(.ts-variant--accent):active { + --button-background-color: var(--button-accent-bg-color--active); + --button-text-color: var(--button-accent-text-color--active); +} + +.ts-button:where(.ts-variant--special):active { + --button-text-color: var(--button-special-text-color--active); + --button-border: var(--button-special-border--active); + + background: var(--button-special-background--active); +} + +.ts-button:where(.ts-variant--success):active { + --button-background-color: var(--button-success-bg-color--active); + --button-text-color: var(--button-success-text-color--active); +} + +.ts-button:where(.ts-variant--info):active { + --button-background-color: var(--button-info-bg-color--active); + --button-text-color: var(--button-info-text-color--active); +} + +.ts-button:where(.ts-variant--warning):active { + --button-background-color: var(--button-warning-bg-color--active); + --button-text-color: var(--button-warning-text-color--active); +} + +.ts-button:where(.ts-variant--danger):active { + --button-background-color: var(--button-danger-bg-color--active); + --button-text-color: var(--button-danger-text-color--active); +} + +/* TOKENS */ +:root { + --button-danger-bg-color--active: var(--color-red--2); + --button-danger-bg-color--default: var(--color-red--4); + --button-danger-bg-color--hover: var(--color-red--3); + --button-danger-text-color--active: var(--color-red--11); + --button-danger-text-color--default: var(--color-red--11); + --button-danger-text-color--hover: var(--color-red--11); + --button-info-bg-color--active: var(--color-blue--2); + --button-info-bg-color--default: var(--color-blue--4); + --button-info-bg-color--hover: var(--color-blue--3); + --button-info-text-color--active: var(--color-blue--11); + --button-info-text-color--default: var(--color-blue--11); + --button-info-text-color--hover: var(--color-blue--11); + --button-primary-bg-color--active: hsl(256deg 60% 42%); + --button-primary-bg-color--default: hsl(256deg 60% 52%); + --button-primary-bg-color--hover: hsl(256deg 67% 56%); + --button-primary-text-color--active: var(--text-primary); + --button-primary-text-color--default: var(--text-primary); + --button-primary-text-color--hover: var(--text-primary); + --button-secondary-bg-color--active: var(--color-surface-alpha--6); + --button-secondary-bg-color--default: var(--color-surface-alpha--7); + --button-secondary-bg-color--hover: var(--color-surface-alpha--8); + --button-secondary-text-color--active: var(--text-primary); + --button-secondary-text-color--default: var(--text-primary); + --button-secondary-text-color--hover: var(--text-primary); + --button-success-bg-color--active: var(--color-green--2); + --button-success-bg-color--default: var(--color-green--4); + --button-success-bg-color--hover: var(--color-green--3); + --button-success-text-color--active: var(--color-green--11); + --button-success-text-color--default: var(--color-green--11); + --button-success-text-color--hover: var(--color-green--11); + --button-warning-bg-color--active: var(--color-yellow--2); + --button-warning-bg-color--default: var(--color-yellow--4); + --button-warning-bg-color--hover: var(--color-yellow--3); + --button-warning-text-color--active: var(--color-yellow--11); + --button-warning-text-color--default: var(--color-yellow--11); + --button-warning-text-color--hover: var(--color-yellow--11); + --button-special-text-color--active: var(--color-primary); + --button-special-text-color--default: var(--color-primary); + --button-special-text-color--hover: var(--color-primary); + --button-special-border--active: 2px solid transparent; + --button-special-border--default: 2px solid transparent; + --button-special-border--hover: 2px solid transparent; + --button-special-background--active: linear-gradient( + 284deg, + hsl(203deg 80% 21% / 1) 0%, + hsl(155deg 46% 23% / 1) 100% + ) + padding-box, + linear-gradient( + 284deg, + hsl(154deg 65% 67% / 1) 0%, + hsl(203deg 92% 63% / 1) 100% + ) + border-box; + --button-special-background--default: linear-gradient( + 284deg, + hsl(275deg 64% 11% / 1) 0%, + hsl(156deg 46% 12% / 1) 100% + ) + padding-box, + linear-gradient( + 284deg, + hsl(276deg 77% 54% / 1) 0%, + hsl(158deg 100% 57% / 1) 100% + ) + border-box; + --button-special-background--hover: linear-gradient( + 284deg, + hsl(203deg 80% 21% / 1) 0%, + hsl(155deg 46% 23% / 1) 100% + ) + padding-box, + linear-gradient( + 284deg, + hsl(154deg 65% 67% / 1) 0%, + hsl(203deg 92% 63% / 1) 100% + ) + border-box; + --button-accent-bg-color--active: var(--color-cyber-green--6); + --button-accent-bg-color--default: var(--color-cyber-green--7); + --button-accent-bg-color--hover: var(--color-cyber-green--9); + --button-accent-text-color--active: var(--color-cyber-green--2); + --button-accent-text-color--default: var(--color-cyber-green--2); + --button-accent-text-color--hover: var(--color-cyber-green--2); +} diff --git a/packages/cyberstorm-theme/src/components/Button/Button.ts b/packages/cyberstorm-theme/src/components/Button/Button.ts new file mode 100644 index 000000000..6f124a48b --- /dev/null +++ b/packages/cyberstorm-theme/src/components/Button/Button.ts @@ -0,0 +1,33 @@ +// Variants +export const ButtonVariantsList = [ + "primary", + "secondary", + "minimal", + "accent", + "special", + "info", + "success", + "warning", + "danger", +] as const; +export type ButtonVariants = + | "primary" + | "secondary" + | "minimal" + | "accent" + | "special" + | "info" + | "success" + | "warning" + | "danger"; + +// Sizes +export const ButtonSizesList = ["big", "medium", "small", "xsmall"] as const; +export type ButtonSizes = "big" | "medium" | "small" | "xsmall"; + +// Modifiers +export const ButtonModifiersList = ["disabled", "subtle", "dimmed"] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type ButtonModifiers = typeof ButtonModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/components/Button/IconButton.css b/packages/cyberstorm-theme/src/components/Button/IconButton.css new file mode 100644 index 000000000..20dc053ea --- /dev/null +++ b/packages/cyberstorm-theme/src/components/Button/IconButton.css @@ -0,0 +1,64 @@ +/* theme base styles */ +.ts-iconbutton { + --button-height: 2rem; + --button-padding: 0 1rem; + --button-border-radius: 0.5rem; +} + +.ts-iconbutton:where(.ts-iconbutton--ghost):where(:not(:hover, :active)) { + background-color: transparent; +} + +.ts-iconbutton[disabled] { + opacity: 0.5; + pointer-events: none; +} + +/* SIZES */ +.ts-iconbutton:where(.ts-size--big) { + --button-height: 3rem; + --button-font-size: 1.4rem; +} + +/* VARIANTS */ +.ts-iconbutton:where(.ts-variant--primary) { + --button-background-color: var(--color-background-button-primary-default); + --button-text-color: var(--color-text-button-primary-default); +} + +.ts-iconbutton:where(.ts-variant--tertiary) { + --button-background-color: var(--color-background-button-primary-default); + --button-text-color: var(--color-text-button-primary-default); +} + +.ts-iconbutton:where(.ts-variant--danger) { + --button-background-color: var(--color-background-button-danger-default); + --button-text-color: var(--color-text-button-danger-hover); +} + +.ts-iconbutton:where(.ts-variant--primary):hover { + --button-background-color: var(--color-background-button-primary-hover); + --button-text-color: var(--color-text-button-primary-hover); +} + +.ts-iconbutton:where(.ts-variant--tertiary):hover { + --button-background-color: var(--color-background-button-primary-hover); + --button-text-color: var(--color-text-button-primary-hover); +} + +.ts-iconbutton:where(.ts-variant--danger):hover { + --button-background-color: var(--color-background-button-danger-hover); + --button-text-color: var(--color-text-button-danger-hover); +} + +/* TOKENS */ +:root { + --color-background-button-primary-default: green; + --color-background-button-primary-hover: forestgreen; + --color-text-button-primary-default: #fff; + --color-text-button-primary-hover: #fff; + --color-background-button-danger-default: darkred; + --color-background-button-danger-hover: red; + --color-text-button-danger-default: #fcd7de; + --color-text-button-danger-hover: #fcd7de; +} diff --git a/packages/cyberstorm-theme/src/components/Button/IconButton.ts b/packages/cyberstorm-theme/src/components/Button/IconButton.ts new file mode 100644 index 000000000..9ec15aaaf --- /dev/null +++ b/packages/cyberstorm-theme/src/components/Button/IconButton.ts @@ -0,0 +1,29 @@ +// Variants +export const IconButtonVariantsList = [ + "primary", + "secondary", + "tertiary", + "minimal", + "danger", +] as const; +export type IconButtonVariants = + | "primary" + | "secondary" + | "tertiary" + | "minimal" + | "danger"; + +// Sizes +export const IconButtonSizesList = ["medium", "small", "xsmall"] as const; +export type IconButtonSizes = "medium" | "small" | "xsmall"; + +// Modifiers +export const IconButtonModifiersList = [ + "disabled", + "subtle", + "dimmed", +] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type IconButtonModifiers = typeof IconButtonModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/components/DropDown/DropDown.css b/packages/cyberstorm-theme/src/components/DropDown/DropDown.css new file mode 100644 index 000000000..f048b6634 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/DropDown/DropDown.css @@ -0,0 +1,21 @@ +/* Missing tokens */ +.ts-dropdown:where(.ts-variant--primary) { + --dropdown-color: var(--color-surface--5); + --dropdown-background-color: var(--color-surface--2); + --dropdown-border-color: var(--color-surface--6); + --dropdown-border: var(--space--px) var(--dropdown-border-color) solid; + --dropdown-border-radius: var(--border-radius--8); + --dropdown-box-shadow: var(--box-shadow-default); + --dropdown-animation: fade-in var(--animation-length-m) ease; + --dropdown-padding: var(--space--8) 0; +} + +@keyframes fade-in { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} diff --git a/packages/cyberstorm-theme/src/components/DropDown/DropDown.ts b/packages/cyberstorm-theme/src/components/DropDown/DropDown.ts new file mode 100644 index 000000000..bf2cc8bed --- /dev/null +++ b/packages/cyberstorm-theme/src/components/DropDown/DropDown.ts @@ -0,0 +1,14 @@ +// Variants +export const DropDownVariantsList = ["primary"] as const; +export type DropDownVariants = "primary"; + +// Sizes +export const DropDownSizesList = ["medium"] as const; +export type DropDownSizes = "medium"; + +// Modifiers +export const DropDownModifiersList = ["disabled", "subtle", "dimmed"] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type DropDownModifiers = typeof DropDownModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/components/DropDown/DropDownDivider.css b/packages/cyberstorm-theme/src/components/DropDown/DropDownDivider.css new file mode 100644 index 000000000..54b842724 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/DropDown/DropDownDivider.css @@ -0,0 +1,9 @@ +/* Missing tokens */ +.ts-dropdown__divider:where(.ts-variant--primary) { + --dropdown__divider-height: var(--space--px); + --dropdown__divider-margin: var(--space--8) 0; + --dropdown__divider-background-color: var( + --color-surface--6, + var(--color-primary, red) + ); +} diff --git a/packages/cyberstorm-theme/src/components/DropDown/DropDownDivider.ts b/packages/cyberstorm-theme/src/components/DropDown/DropDownDivider.ts new file mode 100644 index 000000000..40c9ec493 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/DropDown/DropDownDivider.ts @@ -0,0 +1,14 @@ +// Variants +export const DropDownDividerVariantsList = ["primary"] as const; +export type DropDownDividerVariants = "primary"; + +// Sizes +export const DropDownDividerSizesList = ["medium"] as const; +export type DropDownDividerSizes = "medium"; + +// Modifiers +export const DropDownDividerModifiersList = ["subtle", "dimmed"] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type DropDownDividerModifiers = typeof DropDownDividerModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/components/DropDown/DropDownItem.css b/packages/cyberstorm-theme/src/components/DropDown/DropDownItem.css new file mode 100644 index 000000000..ebbdbfa40 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/DropDown/DropDownItem.css @@ -0,0 +1,11 @@ +/* Missing tokens */ +.ts-dropdown__item:where(.ts-variant--primary) { + --dropdown__item-padding: var(--space--12) var(--space--16); + --dropdown__item-color: var(--color-surface--8); + --dropdown__item-background-color: var(--color-surface--2); +} + +.ts-dropdown__item:where(.ts-variant--primary)[data-highlighted] { + --dropdown__item-highlighted-color: var(--color-surface--2); + --dropdown__item-highlighted-background-color: var(--color-surface--6); +} diff --git a/packages/cyberstorm-theme/src/components/DropDown/DropDownItem.ts b/packages/cyberstorm-theme/src/components/DropDown/DropDownItem.ts new file mode 100644 index 000000000..b9858a9d5 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/DropDown/DropDownItem.ts @@ -0,0 +1,18 @@ +// Variants +export const DropDownItemVariantsList = ["primary"] as const; +export type DropDownItemVariants = "primary"; + +// Sizes +export const DropDownItemSizesList = ["medium"] as const; +export type DropDownItemSizes = "medium"; + +// Modifiers +export const DropDownItemModifiersList = [ + "disabled", + "subtle", + "dimmed", +] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type DropDownItemModifiers = typeof DropDownItemModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/components/Heading/Heading.css b/packages/cyberstorm-theme/src/components/Heading/Heading.css new file mode 100644 index 000000000..7d574f986 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/Heading/Heading.css @@ -0,0 +1 @@ +/* Missing tokens */ diff --git a/packages/cyberstorm-theme/src/components/Heading/Heading.ts b/packages/cyberstorm-theme/src/components/Heading/Heading.ts new file mode 100644 index 000000000..d485bf9a8 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/Heading/Heading.ts @@ -0,0 +1,19 @@ +// Variants +export const HeadingVariantsList = [ + "primary", + "secondary", + "tertiary", + "accent", +] as const; +export type HeadingVariants = "primary" | "secondary" | "tertiary" | "accent"; + +// Sizes +export const HeadingSizesList = ["1", "2", "3", "4", "5", "6"] as const; +export type HeadingSizes = "1" | "2" | "3" | "4" | "5" | "6"; + +// Modifiers +export const HeadingModifiersList = ["subtle", "dimmed"] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type HeadingModifiers = typeof HeadingModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/components/TextInput/TextInput.css b/packages/cyberstorm-theme/src/components/TextInput/TextInput.css new file mode 100644 index 000000000..43e744ff6 --- /dev/null +++ b/packages/cyberstorm-theme/src/components/TextInput/TextInput.css @@ -0,0 +1,87 @@ +.ts-textinput { + --textinput-width: 100%; + --textinput-padding: var(--space--8) var(--space--14); + --textinput-border: var(--border-width--2) solid var(--textinput-border-color); + --textinput-border-radius: var(--border-radius--8); + --textinput-transition: ease-out var(--animation-length-xs); + --textinput-border-color: transparent; + --textinput-text-color: var(--color-primary); + --textinput-background-color: var(--color-surface-alpha--5); +} + +.ts-textinput__wrapper { + --textinput__wrapper-width: auto; + --textinput__wrapper-line-height: var(--line-height--auto); + --textinput__wrapper-font-weight: var(--font-weight--regular); + --textinput__wrapper-font-size: var(--font-size--m); +} + +.ts-textinput[value] { + --textinput-text-color: var(--color-secondary); +} + +.ts-textinput:where(.ts-size--default) { + --textinput-height: var(--space--44); + --textinput-padding: var(--space--12) + calc(var(--space--16) + var(--right-padding-bonus, 0px)) var(--space--12) + calc(var(--space--16) + var(--left-padding-bonus, 0px)); +} + +.ts-textinput:where(.ts-size--small) { + --textinput-height: var(--space--36); + --textinput-padding: var(--space--10) + calc(var(--space--16) + var(--right-padding-bonus, 0px)) var(--space--10) + calc(var(--space--16) + var(--left-padding-bonus, 0px)); +} + +.ts-textinput:where(.ts-textinput__haslefticon) { + --left-padding-bonus: var(--space--24); +} + +.ts-textinput:where(.ts-textinput__hasclearvalue) { + --right-padding-bonus: var(--space--16); +} + +.ts-textinput:hover { + --textinput-background-color: var(--color-surface-alpha--6); + --textinput-border-color: var(--color-surface-alpha--10); +} + +.ts-textinput:focus-within { + --textinput-text-color: var(--color-primary); + --textinput-background-color: var(--color-black); + --textinput-border-color: var(--color-cyber-green--7); +} + +.ts-textinput:has(+ .ts-textinput__clearvaluebutton:hover):not(:focus-within) { + --input-background-color: var(--color-surface-alpha--6); + --border-color: var(--color-surface-alpha--10); +} + +.ts-textinput::placeholder { + --textinput__placeholder-color: var(--color-text--tertiary); + --textinput__placeholder-opacity: 1; +} + +.ts-textinput__lefticon { + --ts-textinput__lefticon-position: absolute; + --ts-textinput__lefticon-margin: var(--space--10) var(--space--16); + --ts-textinput__lefticon-color: var(--color-tertiary); + --ts-textinput__lefticon-pointer-events: none; +} + +.ts-textinput__righticon { + --ts-textinput__righticon-position: absolute; + --ts-textinput__righticon-padding: var(--space--14) var(--space--16); + --ts-textinput__righticon-color: var(--color-secondary); +} + +.ts-textinput__clearvaluebutton { + --ts-textinput__clearvaluebutton-right: var(--space--16); + --ts-textinput__clearvaluebutton-color: var(--color-secondary); + --ts-textinput__clearvaluebutton-opacity: 0.5; +} + +.ts-textinput__clearvaluebutton:hover { + --ts-textinput__clearvaluebutton-opacity: 1; +} diff --git a/packages/cyberstorm-theme/src/components/TextInput/TextInput.ts b/packages/cyberstorm-theme/src/components/TextInput/TextInput.ts new file mode 100644 index 000000000..adb210bfc --- /dev/null +++ b/packages/cyberstorm-theme/src/components/TextInput/TextInput.ts @@ -0,0 +1,14 @@ +// Variants +export const TextInputVariantsList = ["primary"] as const; +export type TextInputVariants = "primary"; + +// Sizes +export const TextInputSizesList = ["default", "textarea", "small"] as const; +export type TextInputSizes = "default" | "textarea" | "small"; + +// Modifiers +export const TextInputModifiersList = ["disabled", "subtle", "dimmed"] as const; +// There is an issue with Typescript (eslint) and prettier disagreeing if +// the type should have parentheses +// prettier-ignore +export type TextInputModifiers = typeof TextInputModifiersList[number]; diff --git a/packages/cyberstorm-theme/src/index.tsx b/packages/cyberstorm-theme/src/index.tsx new file mode 100644 index 000000000..23baececd --- /dev/null +++ b/packages/cyberstorm-theme/src/index.tsx @@ -0,0 +1,9 @@ +import "./styles/colors.css"; +import "./styles/typography.css"; +import "./components/Button/Button.css"; +import "./components/Button/IconButton.css"; +import "./components/Heading/Heading.css"; +import "./components/DropDown/DropDown.css"; +import "./components/DropDown/DropDownItem.css"; +import "./components/DropDown/DropDownDivider.css"; +import "./components/TextInput/TextInput.css"; diff --git a/packages/cyberstorm-theme/src/styles/colors.css b/packages/cyberstorm-theme/src/styles/colors.css new file mode 100644 index 000000000..315f46b33 --- /dev/null +++ b/packages/cyberstorm-theme/src/styles/colors.css @@ -0,0 +1,258 @@ +:root { + --color-black: rgb(0 0 0); + --color-white: rgb(255 255 255); + --color-primary: hsl(240deg 5% 96% / 1); + --color-secondary: hsl(231deg 46% 86% / 1); + --color-tertiary: hsl(230deg 32% 74% / 1); + --color-accent: hsl(243deg 100% 88% / 1); + --color-surface--1: hsl(240deg 65% 8% / 1); + --color-surface--2: hsl(240deg 43% 11% / 1); + --color-surface--3: hsl(240deg 39% 13% / 1); + --color-surface--4: hsl(236deg 38% 16% / 1); + --color-surface--5: hsl(240deg 36% 19% / 1); + --color-surface--6: hsl(240deg 37% 22% / 1); + --color-surface--7: hsl(240deg 38% 26% / 1); + --color-surface--8: hsl(240deg 37% 32% / 1); + --color-surface--9: hsl(240deg 38% 38% / 1); + --color-surface--10: hsl(240deg 38% 47% / 1); + --color-surface--11: hsl(246deg 50% 42% / 1); + --color-surface-alpha--1: hsl(240deg 100% 90% / 0.05); + --color-surface-alpha--2: hsl(240deg 35% 32% / 0.09); + --color-surface-alpha--3: hsl(240deg 30% 32% / 0.15); + --color-surface-alpha--4: hsl(236deg 36% 36% / 0.24); + --color-surface-alpha--5: hsl(240deg 33% 39% / 0.32); + --color-surface-alpha--6: hsl(240deg 35% 37% / 0.44); + --color-surface-alpha--7: hsl(240deg 37% 39% / 0.55); + --color-surface-alpha--8: hsl(240deg 36% 43% / 0.66); + --color-surface-alpha--9: hsl(240deg 39% 47% / 0.77); + --color-surface-alpha--10: hsla(240deg 38% 51% / 0.88); + --color-surface-alpha--11: hsla(246deg 49% 48% / 0.85); + --color-blue--1: hsl(203deg 78% 5% / 1); + --color-blue--2: hsl(202deg 78% 11% / 1); + --color-blue--3: hsl(202deg 80% 16% / 1); + --color-blue--4: hsl(203deg 80% 21% / 1); + --color-blue--5: hsl(203deg 79% 32% / 1); + --color-blue--6: hsl(203deg 80% 43% / 1); + --color-blue--7: hsl(203deg 92% 54% / 1); + --color-blue--8: hsl(203deg 92% 63% / 1); + --color-blue--9: hsl(203deg 92% 72% / 1); + --color-blue--10: hsl(203deg 92% 86% / 1); + --color-blue--11: hsl(202deg 92% 95% / 1); + --color-pink--1: hsl(305deg 42% 6% / 1); + --color-pink--2: hsl(306deg 45% 12% / 1); + --color-pink--3: hsl(306deg 44% 18% / 1); + --color-pink--4: hsl(305deg 45% 24% / 1); + --color-pink--5: hsl(307deg 44% 36% / 1); + --color-pink--6: hsl(306deg 44% 48% / 1); + --color-pink--7: hsl(306deg 68% 61% / 1); + --color-pink--8: hsl(306deg 68% 68% / 1); + --color-pink--9: hsl(307deg 68% 76% / 1); + --color-pink--10: hsl(305deg 68% 84% / 1); + --color-pink--11: hsl(306deg 70% 92% / 1); + --color-red--1: hsl(350deg 60% 6% / 1); + --color-red--2: hsl(349deg 63% 12% / 1); + --color-red--3: hsl(349deg 62% 17% / 1); + --color-red--4: hsl(349deg 63% 23% / 1); + --color-red--5: hsl(349deg 62% 35% / 1); + --color-red--6: hsl(349deg 62% 47% / 1); + --color-red--7: hsl(349deg 87% 58% / 1); + --color-red--8: hsl(349deg 87% 67% / 1); + --color-red--9: hsl(349deg 87% 75% / 1); + --color-red--10: hsl(349deg 86% 83% / 1); + --color-red--11: hsl(349deg 86% 92% / 1); + --color-orange--1: hsl(16deg 61% 6% / 1); + --color-orange--2: hsl(13deg 58% 12% / 1); + --color-orange--3: hsl(14deg 59% 18% / 1); + --color-orange--4: hsl(15deg 59% 24% / 1); + --color-orange--5: hsl(14deg 59% 36% / 1); + --color-orange--6: hsl(15deg 60% 48% / 1); + --color-orange--7: hsl(14deg 91% 61% / 1); + --color-orange--8: hsl(15deg 91% 68% / 1); + --color-orange--9: hsl(14deg 92% 76% / 1); + --color-orange--10: hsl(15deg 90% 84% / 1); + --color-orange--11: hsl(13deg 90% 92% / 1); + --color-green--1: hsl(154deg 47% 6% / 1); + --color-green--2: hsl(156deg 46% 12% / 1); + --color-green--3: hsl(155deg 46% 17% / 1); + --color-green--4: hsl(155deg 46% 23% / 1); + --color-green--5: hsl(154deg 46% 35% / 1); + --color-green--6: hsl(154deg 46% 47% / 1); + --color-green--7: hsl(155deg 64% 58% / 1); + --color-green--8: hsl(154deg 65% 67% / 1); + --color-green--9: hsl(154deg 64% 75% / 1); + --color-green--10: hsl(155deg 65% 83% / 1); + --color-green--11: hsl(156deg 63% 92% / 1); + --color-yellow--1: hsl(49deg 50% 6% / 1); + --color-yellow--2: hsl(45deg 51% 13% / 1); + --color-yellow--3: hsl(47deg 51% 19% / 1); + --color-yellow--4: hsl(47deg 50% 25% / 1); + --color-yellow--5: hsl(47deg 51% 38% / 1); + --color-yellow--6: hsl(47deg 52% 50% / 1); + --color-yellow--7: hsl(47deg 87% 63% / 1); + --color-yellow--8: hsl(47deg 87% 70% / 1); + --color-yellow--9: hsl(47deg 88% 78% / 1); + --color-yellow--10: hsl(47deg 87% 85% / 1); + --color-yellow--11: hsl(45deg 89% 93% / 1); + --color-purple--1: hsl(277deg 50% 6% / 1); + --color-purple--2: hsl(277deg 50% 13% / 1); + --color-purple--3: hsl(277deg 51% 19% / 1); + --color-purple--4: hsl(277deg 50% 25% / 1); + --color-purple--5: hsl(276deg 50% 38% / 1); + --color-purple--6: hsl(276deg 52% 51% / 1); + --color-purple--7: hsl(277deg 86% 63% / 1); + --color-purple--8: hsl(276deg 87% 71% / 1); + --color-purple--9: hsl(276deg 86% 78% / 1); + --color-purple--10: hsl(277deg 87% 85% / 1); + --color-purple--11: hsl(277deg 84% 93% / 1); + --color-cyber-green--1: transparent; + --color-cyber-green--2: hsl(161deg 79% 5% / 1); + --color-cyber-green--3: hsl(158deg 76% 11% / 1); + --color-cyber-green--4: hsl(158deg 76% 23% / 1); + --color-cyber-green--5: hsl(159deg 76% 34% / 1); + --color-cyber-green--6: hsl(159deg 76% 45% / 1); + --color-cyber-green--7: hsl(158deg 100% 57% / 1); + --color-cyber-green--8: hsl(159deg 100% 65% / 1); + --color-cyber-green--9: hsl(159deg 100% 74% / 1); + --color-cyber-green--10: hsl(159deg 100% 78% / 1); + --color-cyber-green--11: hsl(158deg 100% 91% / 1); +} + +[data-color="surface"] { + --color-1: var(--color-surface--1); + --color-2: var(--color-surface--2); + --color-3: var(--color-surface--3); + --color-4: var(--color-surface--4); + --color-5: var(--color-surface--5); + --color-6: var(--color-surface--6); + --color-7: var(--color-surface--7); + --color-8: var(--color-surface--8); + --color-9: var(--color-surface--9); + --color-10: var(--color-surface--10); + --color-11: var(--color-surface--11); +} + +[data-color="surface-alpha"] { + --color-1: var(--color-surface-alpha--1); + --color-2: var(--color-surface-alpha--2); + --color-3: var(--color-surface-alpha--3); + --color-4: var(--color-surface-alpha--4); + --color-5: var(--color-surface-alpha--5); + --color-6: var(--color-surface-alpha--6); + --color-7: var(--color-surface-alpha--7); + --color-8: var(--color-surface-alpha--8); + --color-9: var(--color-surface-alpha--9); + --color-10: var(--color-surface-alpha--10); + --color-11: var(--color-surface-alpha--11); +} + +[data-color="blue"] { + --color-1: var(--color-blue--1); + --color-2: var(--color-blue--2); + --color-3: var(--color-blue--3); + --color-4: var(--color-blue--4); + --color-5: var(--color-blue--5); + --color-6: var(--color-blue--6); + --color-7: var(--color-blue--7); + --color-8: var(--color-blue--8); + --color-9: var(--color-blue--9); + --color-10: var(--color-blue--10); + --color-11: var(--color-blue--11); +} + +[data-color="pink"] { + --color-1: var(--color-pink--1); + --color-2: var(--color-pink--2); + --color-3: var(--color-pink--3); + --color-4: var(--color-pink--4); + --color-5: var(--color-pink--5); + --color-6: var(--color-pink--6); + --color-7: var(--color-pink--7); + --color-8: var(--color-pink--8); + --color-9: var(--color-pink--9); + --color-10: var(--color-pink--10); + --color-11: var(--color-pink--11); +} + +[data-color="red"] { + --color-1: var(--color-red--1); + --color-2: var(--color-red--2); + --color-3: var(--color-red--3); + --color-4: var(--color-red--4); + --color-5: var(--color-red--5); + --color-6: var(--color-red--6); + --color-7: var(--color-red--7); + --color-8: var(--color-red--8); + --color-9: var(--color-red--9); + --color-10: var(--color-red--10); + --color-11: var(--color-red--11); +} + +[data-color="orange"] { + --color-1: var(--color-orange--1); + --color-2: var(--color-orange--2); + --color-3: var(--color-orange--3); + --color-4: var(--color-orange--4); + --color-5: var(--color-orange--5); + --color-6: var(--color-orange--6); + --color-7: var(--color-orange--7); + --color-8: var(--color-orange--8); + --color-9: var(--color-orange--9); + --color-10: var(--color-orange--10); + --color-11: var(--color-orange--11); +} + +[data-color="green"] { + --color-1: var(--color-green--1); + --color-2: var(--color-green--2); + --color-3: var(--color-green--3); + --color-4: var(--color-green--4); + --color-5: var(--color-green--5); + --color-6: var(--color-green--6); + --color-7: var(--color-green--7); + --color-8: var(--color-green--8); + --color-9: var(--color-green--9); + --color-10: var(--color-green--10); + --color-11: var(--color-green--11); +} + +[data-color="yellow"] { + --color-1: var(--color-yellow--1); + --color-2: var(--color-yellow--2); + --color-3: var(--color-yellow--3); + --color-4: var(--color-yellow--4); + --color-5: var(--color-yellow--5); + --color-6: var(--color-yellow--6); + --color-7: var(--color-yellow--7); + --color-8: var(--color-yellow--8); + --color-9: var(--color-yellow--9); + --color-10: var(--color-yellow--10); + --color-11: var(--color-yellow--11); +} + +[data-color="purple"] { + --color-1: var(--color-purple--1); + --color-2: var(--color-purple--2); + --color-3: var(--color-purple--3); + --color-4: var(--color-purple--4); + --color-5: var(--color-purple--5); + --color-6: var(--color-purple--6); + --color-7: var(--color-purple--7); + --color-8: var(--color-purple--8); + --color-9: var(--color-purple--9); + --color-10: var(--color-purple--10); + --color-11: var(--color-purple--11); +} + +[data-color="cyber-green"] { + --color-1: var(--color-cyber-green--1); + --color-2: var(--color-cyber-green--2); + --color-3: var(--color-cyber-green--3); + --color-4: var(--color-cyber-green--4); + --color-5: var(--color-cyber-green--5); + --color-6: var(--color-cyber-green--6); + --color-7: var(--color-cyber-green--7); + --color-8: var(--color-cyber-green--8); + --color-9: var(--color-cyber-green--9); + --color-10: var(--color-cyber-green--10); + --color-11: var(--color-cyber-green--11); +} diff --git a/packages/cyberstorm-theme/src/styles/typography.css b/packages/cyberstorm-theme/src/styles/typography.css new file mode 100644 index 000000000..00f869759 --- /dev/null +++ b/packages/cyberstorm-theme/src/styles/typography.css @@ -0,0 +1,15 @@ +:root { + --line-height--auto: normal; + --line-height--body: 170%; + --font-size--xxs: 0.625rem; + --font-size--xs: 0.75rem; + --font-size--s: 0.875rem; + --font-size--m: 1rem; + --font-size--l: 1.5rem; + --font-weight--regular: 400; + --font-weight--medium: 500; + --font-weight--semibold: 600; + --font-weight--bold: 700; + --font-family--inter: inter, sans-serif; + --font-family--hubot: hubot-sans, sans-serif; +} diff --git a/packages/cyberstorm-theme/tsconfig.json b/packages/cyberstorm-theme/tsconfig.json new file mode 100644 index 000000000..1043b8447 --- /dev/null +++ b/packages/cyberstorm-theme/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "skipLibCheck": true, + "moduleResolution": "node", + "removeComments": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "resolveJsonModule": true, + "forceConsistentCasingInFileNames": true, + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "jsx": "react-jsx" + }, + "include": ["./src/**/*.tsx", "./src/**/*.ts", "./src/**/*.css"], + "exclude": ["node_modules"] +} diff --git a/packages/cyberstorm/package.json b/packages/cyberstorm/package.json index f4aa6ffe2..dea593f88 100644 --- a/packages/cyberstorm/package.json +++ b/packages/cyberstorm/package.json @@ -29,6 +29,7 @@ "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-toast": "^1.2.1", "@radix-ui/react-tooltip": "^1.1.2", + "@thunderstore/cyberstorm-theme": "^0.1.0", "@thunderstore/dapper": "^0.1.0", "@thunderstore/thunderstore-api": "*", "@thunderstore/use-promise": "^0.1.0", diff --git a/packages/cyberstorm/src/components/Footer/Footer.module.css b/packages/cyberstorm/src/components/Footer/Footer.module.css index 87b701794..e3bba03ec 100644 --- a/packages/cyberstorm/src/components/Footer/Footer.module.css +++ b/packages/cyberstorm/src/components/Footer/Footer.module.css @@ -118,6 +118,7 @@ .adDescription { max-width: 29rem; + color: var(--color-accent); font-weight: 400; font-size: 1.125rem; line-height: 160%; @@ -149,6 +150,7 @@ .iconLinks { display: flex; gap: 30px; + color: var(--color-accent); } .iconLink { diff --git a/packages/cyberstorm/src/components/Footer/Footer.tsx b/packages/cyberstorm/src/components/Footer/Footer.tsx index b1c7a44ae..c3ca3f96f 100644 --- a/packages/cyberstorm/src/components/Footer/Footer.tsx +++ b/packages/cyberstorm/src/components/Footer/Footer.tsx @@ -7,7 +7,7 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { ThunderstoreLogoHorizontal } from "../../svg/svg"; import { classnames } from "../../utils/utils"; -import { Container, Heading, LinkButton, List, NewIcon, NewLink } from "../.."; +import { Heading, LinkButton, List, NewIcon, NewLink } from "../.."; const AD_IMAGE_SRC = "/cyberstorm-static/images/tsmm_screenshot.png"; const DISCORD_URL = "https://discord.thunderstore.io/"; @@ -26,7 +26,7 @@ export function Footer() { - +
- +
@@ -143,24 +143,20 @@ export function Footer() {
- + Thunderstore Mod Manager - +
You are prepared. Download Thunderstore Mod Manager for desktop and enter a world of Thunder{" "} - +
@@ -183,9 +179,13 @@ export function Footer() {
- News - - +
© 2024 Thunderstore and contributors. This page is{" "} open-source ❤ - +
diff --git a/packages/cyberstorm/src/index.ts b/packages/cyberstorm/src/index.ts index 81239c957..546758331 100644 --- a/packages/cyberstorm/src/index.ts +++ b/packages/cyberstorm/src/index.ts @@ -101,13 +101,7 @@ export { Input, type InputTextInputProps, } from "./primitiveComponents/Input/Input"; -export { - type variants, - type colors, - type sizes, - type TextStyles, - type PrimitiveComponentDefaultProps, -} from "./primitiveComponents/utils/utils"; +export { type PrimitiveComponentDefaultProps } from "./primitiveComponents/utils/utils"; // newComponents export { Menu } from "./newComponents/Menu/Menu"; @@ -118,7 +112,6 @@ export { Link as NewLink } from "./newComponents/Link/Link/Link"; export { LinkButton } from "./newComponents/Link/LinkButton/LinkButton"; export { Button as NewButton } from "./newComponents/Button/Button"; export { BreadCrumbs as NewBreadCrumbs } from "./newComponents/BreadCrumbs/BreadCrumbs"; -export { Container } from "./newComponents/Container/Container"; export { TextInput as NewTextInput } from "./newComponents/TextInput/TextInput"; export { Text as NewText } from "./newComponents/Text/Text"; export { diff --git a/packages/cyberstorm/src/newComponents/AdContainer/AdContainer.tsx b/packages/cyberstorm/src/newComponents/AdContainer/AdContainer.tsx index e7cf2f178..7120e3902 100644 --- a/packages/cyberstorm/src/newComponents/AdContainer/AdContainer.tsx +++ b/packages/cyberstorm/src/newComponents/AdContainer/AdContainer.tsx @@ -1,7 +1,8 @@ import styles from "./AdContainer.module.css"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faHeart } from "@fortawesome/free-solid-svg-icons"; -import { Container, NewIcon } from "../.."; +import { NewIcon } from "../.."; +import { classnames } from "../../utils/utils"; interface AdContainerProps { containerId: string; @@ -11,12 +12,13 @@ export function AdContainer(props: AdContainerProps) { const { containerId } = props; return ( -
Thunderstore development is made possible with ads. Please consider @@ -31,8 +33,8 @@ export function AdContainer(props: AdContainerProps) {
- - +
+
); } diff --git a/packages/cyberstorm/src/newComponents/Button/Button.css b/packages/cyberstorm/src/newComponents/Button/Button.css new file mode 100644 index 000000000..1388dc44a --- /dev/null +++ b/packages/cyberstorm/src/newComponents/Button/Button.css @@ -0,0 +1,24 @@ +.ts-button { + display: flex; + flex: none; + flex-direction: row; + gap: var(--button-gap); + align-items: center; + + height: var(--button-height); + + padding: var(--button-padding); + + border: var(--button-border); + border-color: var(--button-border-color); + border-radius: var(--button-border-radius); + color: var(--button-text-color); + + font-weight: var(--button-font-weight); + font-size: var(--button-font-size); + line-height: var(--button-line-height); + + text-align: center; + background-color: var(--button-background-color); + user-select: none; +} diff --git a/packages/cyberstorm/src/newComponents/Button/Button.tsx b/packages/cyberstorm/src/newComponents/Button/Button.tsx index 007f60748..08b185b1b 100644 --- a/packages/cyberstorm/src/newComponents/Button/Button.tsx +++ b/packages/cyberstorm/src/newComponents/Button/Button.tsx @@ -1,7 +1,7 @@ -import buttonStyles from "../../sharedComponentStyles/ButtonStyles/Button.module.css"; -import iconButtonStyles from "../../sharedComponentStyles/ButtonStyles/IconButton.module.css"; +import "./Button.css"; +import "./IconButton.css"; import React from "react"; -import { classnames } from "../../utils/utils"; +import { classnames, componentClasses } from "../../utils/utils"; import { ActionableButtonProps, Actionable, @@ -9,34 +9,26 @@ import { import { IconProp } from "@fortawesome/fontawesome-svg-core"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { NewIcon } from "../.."; +import { + ButtonVariants, + ButtonSizes, + ButtonModifiers, + IconButtonVariants, + IconButtonModifiers, + IconButtonSizes, +} from "@thunderstore/cyberstorm-theme/src/components"; interface ButtonProps extends Omit { - csVariant?: - | "default" - | "defaultPeek" - | "primary" - | "secondary" - | "tertiary" - | "minimal" - | "accent" - | "special"; - csSize?: "xs" | "s" | "m" | "l"; + csVariant?: ButtonVariants; + csSize?: ButtonSizes; + csModifiers?: ButtonModifiers[]; } interface IconButtonProps - extends Omit< - ActionableButtonProps, - "primitiveType" | "csVariant" | "csSize" | "children" - > { - csVariant?: - | "default" - | "defaultPeek" - | "primary" - | "secondary" - | "tertiary" - | "tertiaryDimmed" - | "minimal"; - csSize?: "xs" | "s" | "m"; + extends Omit { + csVariant?: IconButtonVariants; + csSize?: IconButtonSizes; + csModifiers?: IconButtonModifiers[]; icon: IconProp; } @@ -44,15 +36,17 @@ export type ButtonComponentProps = | ({ icon?: false } & ButtonProps) | ({ icon: IconProp } & IconButtonProps); +// TODO: Add style support for disabled export const Button = React.forwardRef( (props: ButtonComponentProps, forwardedRef) => { - const { rootClasses, csTextStyles, icon, ...forwardedProps } = props; + const { rootClasses, icon, ...forwardedProps } = props; + // TODO: ICON BUTTOND CSS TOKENS NOT SUPPORTED YET if (icon) { const { - csVariant = "default", - csColor = "purple", - csSize = "m", + csVariant = "primary", + csSize = "medium", + csModifiers, ...fProps } = forwardedProps as IconButtonProps; @@ -60,10 +54,11 @@ export const Button = React.forwardRef( @@ -75,36 +70,21 @@ export const Button = React.forwardRef( const { children, - csVariant = "default", - csColor = "purple", - csSize = "m", + csVariant = "primary", + csSize = "medium", + csModifiers, ...fProps } = forwardedProps as ButtonProps; - // TODO: Turn into a proper resolver function - // Same logic is in LinkButton too - const fontStyles = (size: typeof csSize) => { - if (size === "xs") { - return ["fontSizeXS", "fontWeightBold", "lineHeightAuto"]; - } else if (size === "s") { - return ["fontSizeS", "fontWeightBold", "lineHeightAuto"]; - } else { - return ["fontSizeM", "fontWeightBold", "lineHeightAuto"]; - } - }; - return ( {children} diff --git a/packages/cyberstorm/src/newComponents/Button/IconButton.css b/packages/cyberstorm/src/newComponents/Button/IconButton.css new file mode 100644 index 000000000..e01228ad4 --- /dev/null +++ b/packages/cyberstorm/src/newComponents/Button/IconButton.css @@ -0,0 +1,19 @@ +.ts-iconbutton { + display: flex; + flex-shrink: 0; + gap: var(--iconbutton-gap); + align-items: center; + justify-content: center; + width: var(--iconbutton-width); + + height: var(--iconbutton-height); + + padding: var(--iconbutton-padding); + + border: var(--iconbutton-border); + border-color: var(--iconbutton-border-color); + border-radius: var(--iconbutton-border-radius); + color: var(--iconbutton-text-color); + background-color: var(--iconbutton-background-color); + user-select: none; +} diff --git a/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.module.css b/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.module.css index 7440915ee..5dab3d02d 100644 --- a/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.module.css +++ b/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.module.css @@ -45,6 +45,7 @@ display: flex; gap: var(--gap--8); align-items: center; + color: var(--color-accent); } .tag { diff --git a/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.tsx b/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.tsx index ca33e2983..5d2ed0329 100644 --- a/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.tsx +++ b/packages/cyberstorm/src/newComponents/Card/CardCommunity/CardCommunity.tsx @@ -8,9 +8,13 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Community } from "@thunderstore/dapper/types"; import styles from "./CardCommunity.module.css"; -import { numberWithSpaces, formatInteger } from "../../../utils/utils"; +import { + numberWithSpaces, + formatInteger, + classnames, +} from "../../../utils/utils"; import { NewLink, NewIcon, Image, NewTag } from "../../.."; -import { Container } from "../../Container/Container"; +import { TooltipWrapper } from "../../../primitiveComponents/utils/utils"; interface Props { community: Community; @@ -22,13 +26,8 @@ export function CardCommunity(props: Props) { const { community, isPopular, isNew } = props; return ( - - +
+
{isPopular ? ( @@ -45,7 +44,7 @@ export function CardCommunity(props: Props) { New ) : null} - +
{community.name} - - + - - - - {formatInteger(community.total_package_count)} - - + + + + {formatInteger(community.total_package_count)} +
+ + - - - - {formatInteger(community.total_download_count)} -
-
-
+
+ + + + {formatInteger(community.total_download_count)} +
+ +
+
); } diff --git a/packages/cyberstorm/src/newComponents/Container/Container.module.css b/packages/cyberstorm/src/newComponents/Container/Container.module.css deleted file mode 100644 index 16566337d..000000000 --- a/packages/cyberstorm/src/newComponents/Container/Container.module.css +++ /dev/null @@ -1,25 +0,0 @@ -.container { - color: var(--container-color); - - --container-color: var(--color-primary); -} - -.container[data-variant="default"] { - --container-color: var(--color-5); -} - -.container[data-variant="primary"] { - --container-color: var(--color-primary); -} - -.container[data-variant="secondary"] { - --container-color: var(--color-secondary); -} - -.container[data-variant="tertiary"] { - --container-color: var(--color-tertiary); -} - -.container[data-variant="accent"] { - --container-color: var(--color-accent); -} diff --git a/packages/cyberstorm/src/newComponents/Container/Container.tsx b/packages/cyberstorm/src/newComponents/Container/Container.tsx deleted file mode 100644 index f42e4f14a..000000000 --- a/packages/cyberstorm/src/newComponents/Container/Container.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import styles from "./Container.module.css"; -import React from "react"; -import { Frame, FrameWindowProps } from "../../primitiveComponents/Frame/Frame"; -import { classnames } from "../../utils/utils"; - -export const Container = React.forwardRef< - HTMLDivElement, - Omit ->((props: Omit, forwardedRef) => { - const { - children, - rootClasses, - csColor = "purple", - csVariant = "primary", - ...forwardedProps - } = props; - const fProps = forwardedProps as FrameWindowProps; - return ( - - {children} - - ); -}); - -Container.displayName = "Container"; diff --git a/packages/cyberstorm/src/newComponents/DropDown/DropDown.css b/packages/cyberstorm/src/newComponents/DropDown/DropDown.css new file mode 100644 index 000000000..a54d3d115 --- /dev/null +++ b/packages/cyberstorm/src/newComponents/DropDown/DropDown.css @@ -0,0 +1,33 @@ +.ts-dropdown { + z-index: 2; + display: flex; + flex-direction: column; + padding: var(--dropdown-padding); + border: var(--dropdown-border); + border-color: var(--dropdown-border-color); + border-radius: var(--dropdown-border-radius); + overflow: hidden; + color: var(--dropdown-text-color); + background-color: var(--dropdown-background-color); + box-shadow: var(--dropdown-box-shadow); + transform-origin: var(--radix-dropdown-menu-content-transform-origin); + animation: var(--dropdown-animation); +} + +.ts-dropdown__item { + padding: var(--dropdown__item-padding); + overflow: hidden; + color: var(--dropdown__item-color); + background-color: var(--dropdown__item-background-color); + outline: none; +} + +.ts-dropdown__item[data-highlighted] { + z-index: 999; +} + +.ts-dropdown__divider { + height: var(--dropdown__divider-height); + margin: var(--dropdown__divider-margin); + background-color: var(--dropdown__divider-background-color); +} diff --git a/packages/cyberstorm/src/newComponents/DropDown/DropDown.module.css b/packages/cyberstorm/src/newComponents/DropDown/DropDown.module.css deleted file mode 100644 index 61c8e8b70..000000000 --- a/packages/cyberstorm/src/newComponents/DropDown/DropDown.module.css +++ /dev/null @@ -1,123 +0,0 @@ -.dropdown { - z-index: 2; - display: flex; - flex-direction: column; - padding: var(--space--8) 0; - border: var(--space--px) var(--dropdown-border-color) solid; - border-radius: var(--border-radius--8); - overflow: hidden; - color: var(--dropdown-color); - background-color: var(--dropdown-background-color); - box-shadow: var(--box-shadow-default); - transform-origin: var(--radix-dropdown-menu-content-transform-origin); - animation: fade-in var(--animation-length-m) ease; - - --dropdown-color: var(--color-primary); - --dropdown-background-color: var(--color-secondary); - --dropdown-border-color: var(--color-tertiary); -} - -.dropdown[data-variant="default"] { - --dropdown-color: var(--color-5); - --dropdown-background-color: var(--color-2); - --dropdown-border-color: var(--color-6); -} - -.dropdown[data-variant="primary"] { - --dropdown-color: var(--color-primary); - --dropdown-background-color: var(--color-secondary); - --dropdown-border-color: var(--color-tertiary); -} - -.dropdown[data-variant="secondary"] { - --dropdown-color: var(--color-secondary); - --dropdown-background-color: var(--color-primary); - --dropdown-border-color: var(--color-accent); -} - -.dropdown[data-variant="tertiary"] { - --dropdown-color: var(--color-tertiary); - --dropdown-background-color: var(--color-accent); - --dropdown-border-color: var(--color-secondary); -} - -.dropdown[data-variant="accent"] { - --dropdown-color: var(--color-accent); - --dropdown-background-color: var(--color-tertiary); - --dropdown-border-color: var(--color-secondary); -} - -.dropdownItem { - padding: var(--space--12) var(--space--16); - overflow: hidden; - color: var(--dropdown-item-color, var(--dropdown-color)); - background-color: var( - --dropdown-item-background-color, - var(--dropdown-background-color) - ); - outline: none; - - --dropdown-item-color: var(--color-tertiary); - --dropdown-item-background-color: var(--color-2); - --dropdown-item-highlighted-background-color: var(--color-6); -} - -.dropdownItem[data-highlighted] { - z-index: 999; - color: var(--dropdown-item-highlighted-color, var(--color-primary)); - background-color: var( - --dropdown-item-highlighted-background-color, - var(--color-primary) - ); -} - -.dropdownItem[data-variant="default"] { - --dropdown-item-color: var(--color-8); - --dropdown-item-background-color: var(--color-2); - --dropdown-item-highlighted-color: var(--color-2); - --dropdown-item-highlighted-background-color: var(--color-6); -} - -.dropdownItem[data-variant="primary"] { - --dropdown-item-color: var(--color-primary); - --dropdown-item-background-color: var(--color-secondary); - --dropdown-item-highlighted-color: var(--color-secondary); - --dropdown-item-highlighted-background-color: var(--color-primary); -} - -.dropdownItem[data-variant="secondary"] { - --dropdown-item-color: var(--color-secondary); - --dropdown-item-background-color: var(--color-primary); - --dropdown-item-highlighted-color: var(--color-primary); - --dropdown-item-highlighted-background-color: var(--color-secondary); -} - -.dropdownItem[data-variant="tertiary"] { - --dropdown-item-color: var(--color-tertiary); - --dropdown-item-background-color: var(--color-accent); - --dropdown-item-highlighted-color: var(--color-accent); - --dropdown-item-highlighted-background-color: var(--color-tertiary); -} - -.dropdownItem[data-variant="accent"] { - --dropdown-item-color: var(--color-accent); - --dropdown-item-background-color: var(--color-tertiary); - --dropdown-item-highlighted-color: var(--color-tertiary); - --dropdown-item-highlighted-background-color: var(--color-accent); -} - -.divider { - height: var(--space--px); - margin: var(--space--8) 0; - background-color: var(--color-6, var(--color-primary, red)); -} - -@keyframes fade-in { - from { - opacity: 0; - } - - to { - opacity: 1; - } -} diff --git a/packages/cyberstorm/src/newComponents/DropDown/DropDown.tsx b/packages/cyberstorm/src/newComponents/DropDown/DropDown.tsx index 32aa8bcd3..94c56fbc0 100644 --- a/packages/cyberstorm/src/newComponents/DropDown/DropDown.tsx +++ b/packages/cyberstorm/src/newComponents/DropDown/DropDown.tsx @@ -1,5 +1,6 @@ +import "./DropDown.css"; import { ReactNode, ReactElement } from "react"; -import styles from "./DropDown.module.css"; +// import styles from "./DropDown.module.css"; import { Root, @@ -9,24 +10,36 @@ import { DropdownMenuItemProps, Item, } from "@radix-ui/react-dropdown-menu"; -import { Container } from "../Container/Container"; -import { classnames } from "../../utils/utils"; +import { classnames, componentClasses } from "../../utils/utils"; import { PrimitiveComponentDefaultProps } from "../../primitiveComponents/utils/utils"; +import { + DropDownVariants, + DropDownSizes, + DropDownModifiers, + DropDownItemModifiers, + DropDownItemSizes, + DropDownItemVariants, + DropDownDividerModifiers, + DropDownDividerSizes, + DropDownDividerVariants, +} from "@thunderstore/cyberstorm-theme/src/components"; interface DropDownProps extends PrimitiveComponentDefaultProps { defaultOpen?: boolean; contentAlignment?: "start" | "center" | "end"; trigger: ReactNode | ReactElement; + csVariant?: DropDownVariants; + csSize?: DropDownSizes; + csModifiers?: DropDownModifiers[]; } export function DropDown(props: DropDownProps) { const { children, rootClasses, - csColor, - csVariant, - csSize, - csTextStyles, + csVariant = "primary", + csSize = "medium", + csModifiers, defaultOpen = false, contentAlignment = "start", trigger, @@ -43,13 +56,10 @@ export function DropDown(props: DropDownProps) { align={contentAlignment} sideOffset={8} className={classnames( - styles.dropdown, - ...(csTextStyles ? csTextStyles : []), + "ts-dropdown", + ...componentClasses(csVariant, csSize, csModifiers), rootClasses )} - data-color={csColor} - data-variant={csVariant} - data-size={csSize} > {children} @@ -60,16 +70,19 @@ export function DropDown(props: DropDownProps) { interface DropDownItemProps extends PrimitiveComponentDefaultProps, - DropdownMenuItemProps {} + DropdownMenuItemProps { + csVariant?: DropDownItemVariants; + csSize?: DropDownItemSizes; + csModifiers?: DropDownItemModifiers[]; +} export function DropDownItem(props: DropDownItemProps) { const { children, rootClasses, - csTextStyles, - csColor, - csVariant, - csSize, + csVariant = "primary", + csSize = "medium", + csModifiers, ...fProps } = props; @@ -77,24 +90,37 @@ export function DropDownItem(props: DropDownItemProps) { {children} ); } -export function DropDownDivider(props: PrimitiveComponentDefaultProps) { - const { rootClasses, ...fProps } = props; +interface DropDownDividerProps extends PrimitiveComponentDefaultProps { + csVariant?: DropDownDividerVariants; + csSize?: DropDownDividerSizes; + csModifiers?: DropDownDividerModifiers[]; +} + +export function DropDownDivider(props: DropDownDividerProps) { + const { + rootClasses, + csVariant = "primary", + csSize = "medium", + csModifiers, + ...fProps + } = props; return ( - ); diff --git a/packages/cyberstorm/src/newComponents/Heading/Heading.css b/packages/cyberstorm/src/newComponents/Heading/Heading.css new file mode 100644 index 000000000..b381627e1 --- /dev/null +++ b/packages/cyberstorm/src/newComponents/Heading/Heading.css @@ -0,0 +1,8 @@ +.ts-heading { + color: var(--heading-text-color); + font-weight: var(--heading-font-weight); + font-size: var(--heading-font-size); + font-family: var(--heading-font-family); + font-style: var(--heading-font-style); + line-height: var(--heading-line-height); +} diff --git a/packages/cyberstorm/src/newComponents/Heading/Heading.module.css b/packages/cyberstorm/src/newComponents/Heading/Heading.module.css deleted file mode 100644 index 73b77ac89..000000000 --- a/packages/cyberstorm/src/newComponents/Heading/Heading.module.css +++ /dev/null @@ -1,21 +0,0 @@ -.heading { - color: var(--heading-color); - - --heading-color: var(--color-primary); -} - -.heading[data-variant="primary"] { - --heading-color: var(--color-primary); -} - -.heading[data-variant="secondary"] { - --heading-color: var(--color-secondary); -} - -.heading[data-variant="tertiary"] { - --heading-color: var(--color-tertiary); -} - -.heading[data-variant="accent"] { - --heading-color: var(--color-accent); -} diff --git a/packages/cyberstorm/src/newComponents/Heading/Heading.tsx b/packages/cyberstorm/src/newComponents/Heading/Heading.tsx index 7419747ee..3297f8e3a 100644 --- a/packages/cyberstorm/src/newComponents/Heading/Heading.tsx +++ b/packages/cyberstorm/src/newComponents/Heading/Heading.tsx @@ -1,17 +1,25 @@ -import styles from "./Heading.module.css"; +import "./Heading.css"; import React from "react"; import { Frame, FrameHeadingProps, FrameDisplayProps, } from "../../primitiveComponents/Frame/Frame"; -import { classnames } from "../../utils/utils"; +import { classnames, componentClasses } from "../../utils/utils"; +import { + HeadingVariants, + HeadingSizes, + HeadingModifiers, +} from "@thunderstore/cyberstorm-theme/src/components"; interface DefaultProps extends React.HTMLAttributes, Omit, Omit { mode?: "heading" | "display"; + csVariant?: HeadingVariants; + csSize?: HeadingSizes; + csModifiers?: HeadingModifiers[]; } export const Heading = React.forwardRef( @@ -19,21 +27,29 @@ export const Heading = React.forwardRef( const { children, rootClasses, - csVariant = "primary", csLevel = "1", - csStyleLevel, + csVariant = "primary", + csModifiers, + csSize, mode = "heading", ...forwardedProps } = props; const fProps = forwardedProps as DefaultProps; + return ( {children} diff --git a/packages/cyberstorm/src/newComponents/Link/Link/Link.module.css b/packages/cyberstorm/src/newComponents/Link/Link/Link.module.css deleted file mode 100644 index 8bb51f0b4..000000000 --- a/packages/cyberstorm/src/newComponents/Link/Link/Link.module.css +++ /dev/null @@ -1,90 +0,0 @@ -/* Common Link styles */ -.link { - color: var(--link-color); - - --link-color: var(--text-color); -} - -.link:hover { - --link-color: var(--text-color); -} - -.link:active { - --link-color: var(--text-color); -} - -.link[data-variant="default"] { - --link-color: var(--color-7); -} - -.link[data-variant="default"]:hover { - --link-color: var(--color-9); -} - -.link[data-variant="default"]:active { - --link-color: var(--color-9); -} - -.link[data-variant="primary"] { - --link-color: var(--color-primary); -} - -.link[data-variant="primary"]:hover { - --link-color: var(--color-primary); -} - -.link[data-variant="primary"]:active { - --link-color: var(--color-primary); -} - -.link[data-variant="secondary"] { - --link-color: var(--color-secondary); -} - -.link[data-variant="secondary"]:hover { - --link-color: var(--color-primary); -} - -.link[data-variant="secondary"]:active { - --link-color: var(--color-primary); -} - -.link[data-variant="tertiary"] { - --link-color: var(--color-tertiary); -} - -.link[data-variant="tertiary"]:hover { - --link-color: var(--color-primary); -} - -.link[data-variant="tertiary"]:active { - --link-color: var(--color-primary); -} - -.link[data-variant="accent"] { - --link-color: var(--color-accent); -} - -.link[data-variant="accent"]:hover { - --link-color: var(--color-primary); -} - -.link[data-variant="accent"]:active { - --link-color: var(--color-primary); -} - -/* Link variants */ - -/* auto */ - -.link[data-variant="auto"] { - display: inline-flex; - align-items: flex-start; -} - -/* body */ - -.link[data-mode="body"] { - display: flex; - align-items: flex-start; -} diff --git a/packages/cyberstorm/src/newComponents/Link/Link/Link.tsx b/packages/cyberstorm/src/newComponents/Link/Link/Link.tsx index 979bb7bde..0a8508ddd 100644 --- a/packages/cyberstorm/src/newComponents/Link/Link/Link.tsx +++ b/packages/cyberstorm/src/newComponents/Link/Link/Link.tsx @@ -3,9 +3,7 @@ import { ActionableCyberstormLinkProps, ActionableLinkProps, } from "../../../primitiveComponents/Actionable/Actionable"; -import styles from "./Link.module.css"; import React from "react"; -import { classnames } from "../../../utils/utils"; export const Link = React.forwardRef< HTMLAnchorElement, @@ -15,12 +13,11 @@ export const Link = React.forwardRef< props: ActionableLinkProps | ActionableCyberstormLinkProps, forwardedRef ) => { - const { children, rootClasses, csVariant, ...forwardedProps } = props; + const { children, rootClasses, ...forwardedProps } = props; return ( {children} diff --git a/packages/cyberstorm/src/newComponents/Link/LinkButton/Button.css b/packages/cyberstorm/src/newComponents/Link/LinkButton/Button.css new file mode 100644 index 000000000..1388dc44a --- /dev/null +++ b/packages/cyberstorm/src/newComponents/Link/LinkButton/Button.css @@ -0,0 +1,24 @@ +.ts-button { + display: flex; + flex: none; + flex-direction: row; + gap: var(--button-gap); + align-items: center; + + height: var(--button-height); + + padding: var(--button-padding); + + border: var(--button-border); + border-color: var(--button-border-color); + border-radius: var(--button-border-radius); + color: var(--button-text-color); + + font-weight: var(--button-font-weight); + font-size: var(--button-font-size); + line-height: var(--button-line-height); + + text-align: center; + background-color: var(--button-background-color); + user-select: none; +} diff --git a/packages/cyberstorm/src/newComponents/Link/LinkButton/LinkButton.tsx b/packages/cyberstorm/src/newComponents/Link/LinkButton/LinkButton.tsx index 4bf3eca71..e643d0cb3 100644 --- a/packages/cyberstorm/src/newComponents/Link/LinkButton/LinkButton.tsx +++ b/packages/cyberstorm/src/newComponents/Link/LinkButton/LinkButton.tsx @@ -3,57 +3,53 @@ import { ActionableCyberstormLinkProps, ActionableLinkProps, } from "../../../primitiveComponents/Actionable/Actionable"; -import styles from "../../../sharedComponentStyles/ButtonStyles/Button.module.css"; import React from "react"; -import { classnames } from "../../../utils/utils"; +import { classnames, componentClasses } from "../../../utils/utils"; +import { + ButtonVariants, + ButtonSizes, + ButtonModifiers, +} from "@thunderstore/cyberstorm-theme/src/components"; + +interface LinkButtonProps extends ActionableLinkProps { + csVariant?: ButtonVariants; + csSize?: ButtonSizes; + csModifiers?: ButtonModifiers[]; +} +interface CyberstormLinkButtonProps extends ActionableCyberstormLinkProps { + csVariant?: ButtonVariants; + csSize?: ButtonSizes; + csModifiers?: ButtonModifiers[]; +} + +// TODO: Add style support for disabled export const LinkButton = React.forwardRef< HTMLAnchorElement, - ActionableLinkProps | ActionableCyberstormLinkProps ->( - ( - props: ActionableLinkProps | ActionableCyberstormLinkProps, - forwardedRef - ) => { - const { - children, - rootClasses, - csVariant = "default", - csColor = "purple", - csSize = "m", - csTextStyles, - ...forwardedProps - } = props; - - // TODO: Turn into a proper resolver function - // Same logic is in LinkButton too - const fontStyles = (size: typeof csSize) => { - if (size === "xs") { - return ["fontSizeXS", "fontWeightBold", "lineHeightAuto"]; - } else if (size === "s") { - return ["fontSizeS", "fontWeightBold", "lineHeightAuto"]; - } else { - return ["fontSizeM", "fontWeightBold", "lineHeightAuto"]; - } - }; + LinkButtonProps | CyberstormLinkButtonProps +>((props: LinkButtonProps | CyberstormLinkButtonProps, forwardedRef) => { + const { + children, + rootClasses, + csVariant = "primary", + csSize = "meedium", + csModifiers, + ...forwardedProps + } = props; - return ( - - {children} - - ); - } -); + return ( + + {children} + + ); +}); LinkButton.displayName = "LinkButton"; diff --git a/packages/cyberstorm/src/newComponents/Menu/Menu.tsx b/packages/cyberstorm/src/newComponents/Menu/Menu.tsx index c40b3c024..c2a72e35f 100644 --- a/packages/cyberstorm/src/newComponents/Menu/Menu.tsx +++ b/packages/cyberstorm/src/newComponents/Menu/Menu.tsx @@ -40,7 +40,8 @@ export function Menu(props: Props) { popovertarget: props.popoverId, popovertargetaction: "close", }} - csVariant="tertiaryDimmed" + csVariant="secondary" + csModifiers={["subtle", "dimmed"]} tooltipText="Close" aria-label="Close" icon={faXmark} diff --git a/packages/cyberstorm/src/newComponents/Modal/Modal.tsx b/packages/cyberstorm/src/newComponents/Modal/Modal.tsx index e760af4a0..2de95f9c2 100644 --- a/packages/cyberstorm/src/newComponents/Modal/Modal.tsx +++ b/packages/cyberstorm/src/newComponents/Modal/Modal.tsx @@ -30,8 +30,8 @@ export function Modal(props: Props) { popovertarget: props.popoverId, popovertargetaction: "close", }} - csVariant="tertiary" - csColor={csColor} + csVariant="secondary" + csModifiers={["subtle"]} rootClasses={styles.modalCloseButton} tooltipText="Close" > diff --git a/packages/cyberstorm/src/newComponents/Select/Select.tsx b/packages/cyberstorm/src/newComponents/Select/Select.tsx index cf682b339..cbeeba9ad 100644 --- a/packages/cyberstorm/src/newComponents/Select/Select.tsx +++ b/packages/cyberstorm/src/newComponents/Select/Select.tsx @@ -12,7 +12,7 @@ import { Viewport, } from "@radix-ui/react-select"; import { classnames } from "../../utils/utils"; -import { Container, NewButton, NewIcon } from "../.."; +import { NewButton, NewIcon } from "../.."; type SelectOption = { value: T; @@ -65,11 +65,15 @@ export function Select(props: SelectProps) { {selectedOption?.leftIcon ? ( @@ -104,18 +108,15 @@ Select.displayName = "Select"; const mapSelectData = (options: SelectOption[]) => { return options.map((option, index) => ( - {option.leftIcon} {option.label} {!option.label && !option.leftIcon ? option.value : null} - +
)); }; diff --git a/packages/cyberstorm/src/newComponents/TextInput/TextInput.css b/packages/cyberstorm/src/newComponents/TextInput/TextInput.css new file mode 100644 index 000000000..be337f6d6 --- /dev/null +++ b/packages/cyberstorm/src/newComponents/TextInput/TextInput.css @@ -0,0 +1,57 @@ +.ts-textinput__wrapper { + position: relative; + display: flex; + align-items: center; + width: var(--textinput__wrapper-width); + font-weight: var(--textinput__wrapper-font-weight); + font-size: var(--textinput__wrapper-font-size); + line-height: var(--textinput__wrapper-line-height); +} + +.ts-textinput__wrapper > input { + outline: none; +} + +.ts-textinput { + display: flex; + flex-direction: row; + align-items: center; + width: var(--textinput-width); + padding: var(--textinput-padding); + border: var(--textinput-border); + border-color: var(--textinput-border-color); + border-radius: var(--textinput-border-radius); + color: var(--textinput-text-color); + background-color: var(--textinput-background-color); + cursor: text; + transition: var(--textinput-transition); +} + +/* DESIGN SYSTEM TODO: Add support for other variants and colors */ + +.ts-textinput::placeholder { + color: var(--textinput__placeholder-color); + opacity: var(--textinput__placeholder-opacity); +} + +.ts-textinput__lefticon { + position: var(--ts-textinput__lefticon-position); + margin: var(--ts-textinput__lefticon-margin); + color: var(--ts-textinput__lefticon-color); + pointer-events: none; +} + +.ts-textinput__righticon { + position: var(--ts-textinput__righticon-position); + padding: var(--ts-textinput__righticon-padding); + color: var(--ts-textinput__righticon-color); +} + +.ts-textinput__clearvaluebutton { + position: absolute; + right: var(--ts-textinput__clearvaluebutton-right); + display: flex; + color: var(--ts-textinput__clearvaluebutton-color); + background: inherit; + opacity: var(--ts-textinput__clearvaluebutton-opacity); +} diff --git a/packages/cyberstorm/src/newComponents/TextInput/TextInput.module.css b/packages/cyberstorm/src/newComponents/TextInput/TextInput.module.css deleted file mode 100644 index 8187a3ea9..000000000 --- a/packages/cyberstorm/src/newComponents/TextInput/TextInput.module.css +++ /dev/null @@ -1,126 +0,0 @@ -.wrapper { - position: relative; - display: flex; - align-items: center; - width: auto; - color: var(--input-wrapper-text-color); - - --input-wrapper-text-color: var(--color-primary); -} - -.wrapper[data-variant="default"] { - --input-wrapper-text-color: var(--color-5); -} - -.wrapper[data-variant="primary"] { - --input-wrapper-text-color: var(--color-primary); -} - -.wrapper[data-variant="secondary"] { - --input-wrapper-text-color: var(--color-secondary); -} - -.wrapper[data-variant="tertiary"] { - --input-wrapper-text-color: var(--color-tertiary); -} - -.wrapper[data-variant="accent"] { - --input-wrapper-text-color: var(--color-accent); -} - -.wrapper > input { - outline: none; -} - -.textInput { - display: flex; - flex-direction: row; - align-items: center; - width: 100%; - padding: var(--space--8) var(--space--14); - border: var(--border-width--2) solid var(--border-color); - border-radius: var(--border-radius--8); - color: var(--input-text-color); - background-color: var(--input-background-color); - cursor: text; - transition: ease-out var(--animation-length-xs); - - --border-color: transparent; - --input-text-color: var(--color-primary); - --input-background-color: var(--color-surface-alpha--5); -} - -.textInput[value] { - --input-text-color: var(--color-secondary); -} - -.textInput:hover { - --input-background-color: var(--color-surface-alpha--6); - --border-color: var(--color-surface-alpha--10); -} - -.textInput:focus-within { - --input-text-color: var(--color-primary); - --input-background-color: var(--color-black); - --border-color: var(--color-7); -} - -.textInput:has(+ .clearValueButton:hover):not(:focus-within) { - --input-background-color: var(--color-surface-alpha--6); - --border-color: var(--color-surface-alpha--10); -} - -/* DESIGN SYSTEM TODO: Add support for other variants and colors */ - -.textInput::placeholder { - color: var(--color-text--tertiary); - opacity: 1; -} - -.textInput[data-size="m"] { - height: var(--space--44); - padding: var(--space--12) - calc(var(--space--16) + var(--right-padding-bonus, 0px)) var(--space--12) - calc(var(--space--16) + var(--left-padding-bonus, 0px)); -} - -.textInput[data-size="s"] { - height: var(--space--36); - padding: var(--space--10) - calc(var(--space--16) + var(--right-padding-bonus, 0px)) var(--space--10) - calc(var(--space--16) + var(--left-padding-bonus, 0px)); -} - -.hasLeftIcon { - --left-padding-bonus: var(--space--24); -} - -.hasClearValue { - --right-padding-bonus: var(--space--16); -} - -.leftIcon { - position: absolute; - margin: var(--space--10) var(--space--16); - color: var(--color-tertiary); - pointer-events: none; -} - -.rightIcon { - position: absolute; - padding: var(--space--14) var(--space--16); - color: var(--color-secondary); -} - -.clearValueButton { - position: absolute; - right: var(--space--16); - display: flex; - color: var(--color-secondary); - background: inherit; - opacity: 0.5; -} - -.clearValueButton:hover { - opacity: 1; -} diff --git a/packages/cyberstorm/src/newComponents/TextInput/TextInput.tsx b/packages/cyberstorm/src/newComponents/TextInput/TextInput.tsx index 2272c6971..27ea4b013 100644 --- a/packages/cyberstorm/src/newComponents/TextInput/TextInput.tsx +++ b/packages/cyberstorm/src/newComponents/TextInput/TextInput.tsx @@ -1,24 +1,29 @@ -import styles from "./TextInput.module.css"; +import "./TextInput.css"; import React from "react"; import { Input, InputTextInputProps, } from "../../primitiveComponents/Input/Input"; -import { classnames } from "../../utils/utils"; +import { classnames, componentClasses } from "../../utils/utils"; import { Frame } from "../../primitiveComponents/Frame/Frame"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faXmark } from "@fortawesome/free-solid-svg-icons"; import { Actionable } from "../../primitiveComponents/Actionable/Actionable"; -import { colors, variants } from "../../primitiveComponents/utils/utils"; import { NewIcon } from "../.."; +import { + TextInputVariants, + TextInputSizes, + TextInputModifiers, +} from "@thunderstore/cyberstorm-theme/src/components"; interface TextInputProps extends Omit { leftIcon?: JSX.Element; rightIcon?: JSX.Element; enterHook?: (value: string | number | readonly string[]) => string | void; clearValue?: () => void; - wrapperColor?: colors; - wrapperVariant?: variants; + csVariant?: TextInputVariants; + csSize?: TextInputSizes; + csModifiers?: TextInputModifiers[]; } // TODO: Finish the styles conversion to new system @@ -30,12 +35,10 @@ export const TextInput = React.forwardRef( rightIcon, clearValue, enterHook, - wrapperColor = "purple", - wrapperVariant = "tertiary", rootClasses, - csColor = "purple", - csSize = "m", csVariant = "primary", + csSize = "default", + csModifiers, ...forwardedProps } = props; const fProps = forwardedProps as InputTextInputProps; @@ -47,17 +50,20 @@ export const TextInput = React.forwardRef( return ( {leftIcon ? ( {leftIcon} @@ -66,14 +72,11 @@ export const TextInput = React.forwardRef( {...fProps} primitiveType={"textInput"} rootClasses={classnames( - styles.textInput, - leftIcon ? styles.hasLeftIcon : null, - clearValue ? styles.hasClearValue : null + "ts-textinput", + leftIcon ? "ts-textinput__haslefticon" : null, + clearValue ? "ts-textinput__hasclearvalue" : null, + ...componentClasses(csVariant, csSize, csModifiers) )} - csColor={csColor} - csSize={csSize} - csVariant={csVariant} - csTextStyles={["fontSizeM", "fontWeightRegular"]} ref={forwardedRef} onKeyDown={onEnter} > @@ -83,11 +86,12 @@ export const TextInput = React.forwardRef( clearValue()} - rootClasses={styles.clearValueButton} + rootClasses={classnames( + "ts-textinput__clearvaluebutton", + ...componentClasses(csVariant, csSize, csModifiers) + )} tooltipText="Clear" tooltipSide="left" - csColor={csColor} - csVariant={"default"} aria-label="Clear search input" > diff --git a/packages/cyberstorm/src/primitiveComponents/Actionable/Actionable.tsx b/packages/cyberstorm/src/primitiveComponents/Actionable/Actionable.tsx index 86717d9ae..318414587 100644 --- a/packages/cyberstorm/src/primitiveComponents/Actionable/Actionable.tsx +++ b/packages/cyberstorm/src/primitiveComponents/Actionable/Actionable.tsx @@ -5,7 +5,6 @@ import { import React from "react"; import { ThunderstoreLinkProps } from "../../components/Links/LinkingProvider"; import { PrimitiveComponentDefaultProps, TooltipWrapper } from "../utils/utils"; -import { classnames } from "../../utils/utils"; export interface ActionableButtonProps extends React.ButtonHTMLAttributes, @@ -43,10 +42,6 @@ export const Actionable = React.forwardRef< children, primitiveType, rootClasses, - csColor, - csVariant, - csSize, - csTextStyles, tooltipText, tooltipSide, ...forwardedProps @@ -58,17 +53,7 @@ export const Actionable = React.forwardRef< return ( - @@ -79,17 +64,7 @@ export const Actionable = React.forwardRef< const fProps = forwardedProps as ActionableLinkProps; return ( - + {children} @@ -103,13 +78,7 @@ export const Actionable = React.forwardRef< diff --git a/packages/cyberstorm/src/primitiveComponents/Frame/Display.module.css b/packages/cyberstorm/src/primitiveComponents/Frame/Display.module.css deleted file mode 100644 index 6c001498a..000000000 --- a/packages/cyberstorm/src/primitiveComponents/Frame/Display.module.css +++ /dev/null @@ -1,37 +0,0 @@ -.display { - font-weight: 700; - font-family: inter, sans-serif; - font-style: normal; - line-height: normal; -} - -.display[data-stylelevel="1"] { - font-weight: var(--font-weight-heavy); - font-size: calc(var(--space--54) * var(--scaling, 1)); - font-family: Hubot-Sans, sans-serif; - line-height: 115%; /* 62.1px */ -} - -.display[data-stylelevel="2"] { - font-weight: var(--font-weight-heavy); - font-size: calc(var(--space--51) * var(--scaling, 1)); - font-family: Hubot-Sans, sans-serif; -} - -.display[data-stylelevel="3"] { - font-weight: 700; - font-size: calc(var(--space--38) * var(--scaling, 1)); - font-family: Hubot-Sans, sans-serif; -} - -.display[data-stylelevel="4"] { - font-size: calc(var(--space--16) * var(--scaling, 1)); -} - -.display[data-stylelevel="5"] { - font-size: calc(var(--space--14) * var(--scaling, 1)); -} - -.display[data-stylelevel="6"] { - font-size: calc(var(--space--12) * var(--scaling, 1)); -} diff --git a/packages/cyberstorm/src/primitiveComponents/Frame/Frame.tsx b/packages/cyberstorm/src/primitiveComponents/Frame/Frame.tsx index ed625764f..701d868a7 100644 --- a/packages/cyberstorm/src/primitiveComponents/Frame/Frame.tsx +++ b/packages/cyberstorm/src/primitiveComponents/Frame/Frame.tsx @@ -1,7 +1,3 @@ -import popooverStyles from "./Popover.module.css"; -import modalStyles from "./Modal.module.css"; -import headingStyles from "./Heading.module.css"; -import displayStyles from "./Display.module.css"; import iconStyles from "./Icon.module.css"; import { classnames } from "./../../utils/utils"; import React from "react"; @@ -35,7 +31,6 @@ export interface FrameHeadingProps extends React.HTMLAttributes, PrimitiveComponentDefaultProps { primitiveType: "heading"; - csStyleLevel: "1" | "2" | "3" | "4" | "5" | "6"; csLevel: "1" | "2" | "3" | "4" | "5" | "6"; } @@ -43,7 +38,6 @@ export interface FrameDisplayProps extends React.HTMLAttributes, PrimitiveComponentDefaultProps { primitiveType: "display"; - csStyleLevel: "1" | "2" | "3" | "4" | "5" | "6"; csLevel: "1" | "2" | "3" | "4" | "5" | "6"; } @@ -118,10 +112,6 @@ export const Frame = React.forwardRef< const { children, primitiveType, - csTextStyles, - csColor, - csVariant, - csSize, rootClasses, tooltipText, tooltipSide, @@ -132,17 +122,7 @@ export const Frame = React.forwardRef< const fProps = forwardedProps as FrameWindowProps; return ( -
+
{children}
@@ -153,17 +133,7 @@ export const Frame = React.forwardRef< const fProps = forwardedProps as FrameListProps; return ( -
    +
      {children}
    @@ -174,17 +144,7 @@ export const Frame = React.forwardRef< const fProps = forwardedProps as FrameListItemProps; return ( -
  • +
  • {children}
  • @@ -192,118 +152,43 @@ export const Frame = React.forwardRef< } if (primitiveType === "heading" || primitiveType == "display") { const fRef = forwardedRef as React.ForwardedRef; - const { csLevel, csStyleLevel, ...strippedForwardedProps } = - forwardedProps as FrameHeadingProps | FrameDisplayProps; - const primitiveStyles = - primitiveType === "heading" - ? headingStyles.heading - : displayStyles.display; + const { csLevel, ...strippedForwardedProps } = forwardedProps as + | FrameHeadingProps + | FrameDisplayProps; let element; if (csLevel === "1") { element = ( -

    +

    {children}

    ); } else if (csLevel === "2") { element = ( -

    +

    {children}

    ); } else if (csLevel === "3") { element = ( -

    +

    {children}

    ); } else if (csLevel === "4") { element = ( -

    +

    {children}

    ); } else if (csLevel === "5") { element = ( -
    +
    {children}
    ); } else if (csLevel === "6") { element = ( -
    +
    {children}
    ); @@ -319,17 +204,7 @@ export const Frame = React.forwardRef< const textProps = forwardedProps as FrameTextProps; return ( -

    +

    {children}

    @@ -350,14 +225,7 @@ export const Frame = React.forwardRef< {...strippedForwardedProps} id={popoverId} {...{ popover: popoverMode }} - className={classnames( - ...(csTextStyles ? csTextStyles : []), - popooverStyles.popover, - rootClasses - )} - data-color={csColor} - data-variant={csVariant} - data-size={csSize} + className={rootClasses} ref={fRef} > {noWrapper ? ( @@ -383,13 +251,7 @@ export const Frame = React.forwardRef< {...strippedForwardedProps} id={popoverId} {...{ popover: "auto" }} - className={classnames( - ...(csTextStyles ? csTextStyles : []), - modalStyles.modal - )} - data-color={csColor} - data-variant={csVariant} - data-size={csSize} + className={rootClasses} ref={fRef} > {noWrapper ? ( @@ -425,13 +287,9 @@ export const Frame = React.forwardRef< child.props.className, iconStyles.icon, noWrapper && csMode === "inline" ? iconStyles.inline : null, - ...(csTextStyles ? csTextStyles : []), rootClasses ), ref: noWrapper ? svgIconRef : null, - "data-color": csColor ? csColor : null, - "data-variant": csVariant ? csVariant : null, - "data-size": csSize ? csSize : null, ...svgFProps, }) ); @@ -448,12 +306,8 @@ export const Frame = React.forwardRef< className={classnames( iconStyles.iconWrapper, iconStyles.inline, - wrapperClasses, - ...(csTextStyles ? csTextStyles : []) + wrapperClasses )} - data-color={csColor} - data-variant={csVariant} - data-size={csSize} ref={spanIconRef} > {clones} @@ -464,14 +318,7 @@ export const Frame = React.forwardRef< content = (
    {clones} diff --git a/packages/cyberstorm/src/primitiveComponents/Frame/Heading.module.css b/packages/cyberstorm/src/primitiveComponents/Frame/Heading.module.css deleted file mode 100644 index c2879194d..000000000 --- a/packages/cyberstorm/src/primitiveComponents/Frame/Heading.module.css +++ /dev/null @@ -1,34 +0,0 @@ -.heading { - font-weight: 700; - font-family: inter, sans-serif; - font-style: normal; - line-height: normal; -} - -.heading[data-stylelevel="1"] { - font-weight: var(--font-weight-heavy); - font-size: var(--space--54); - font-family: Hubot-Sans, sans-serif; - line-height: 115%; /* 62.1px */ -} - -.heading[data-stylelevel="2"] { - font-size: var(--space--32); - line-height: 140%; /* 44.8px */ -} - -.heading[data-stylelevel="3"] { - font-size: var(--space--20); -} - -.heading[data-stylelevel="4"] { - font-size: var(--space--16); -} - -.heading[data-stylelevel="5"] { - font-size: var(--space--14); -} - -.heading[data-stylelevel="6"] { - font-size: var(--space--12); -} diff --git a/packages/cyberstorm/src/primitiveComponents/Frame/Modal.module.css b/packages/cyberstorm/src/primitiveComponents/Frame/Modal.module.css deleted file mode 100644 index 153dadbb9..000000000 --- a/packages/cyberstorm/src/primitiveComponents/Frame/Modal.module.css +++ /dev/null @@ -1,18 +0,0 @@ -.modal { - width: 100%; - height: 100%; - background: rgba(0 0 0 / 0.6); - backdrop-filter: blur(10px); -} - -.modal[data-size="s"] { - --frame-modal-gap: 1rem; - --frame-modal-padding: 1.5rem 2.25rem; - --frame-modal-border-radius: 0.25rem; -} - -.modal[data-size="m"] { - --frame-modal-gap: 2rem; - --frame-modal-padding: 3rem 5.5rem; - --frame-modal-border-radius: 0.5rem; -} diff --git a/packages/cyberstorm/src/primitiveComponents/Frame/Popover.module.css b/packages/cyberstorm/src/primitiveComponents/Frame/Popover.module.css deleted file mode 100644 index f53e14f40..000000000 --- a/packages/cyberstorm/src/primitiveComponents/Frame/Popover.module.css +++ /dev/null @@ -1,11 +0,0 @@ -.popover[data-size="s"] { - --frame-popover-gap: 1rem; - --frame-popover-padding: 1.5rem 2.25rem; - --frame-popover-border-radius: 0.25rem; -} - -.popover[data-size="m"] { - --frame-popover-gap: 2rem; - --frame-popover-padding: 3rem 5.5rem; - --frame-popover-border-radius: 0.5rem; -} diff --git a/packages/cyberstorm/src/primitiveComponents/Input/Input.tsx b/packages/cyberstorm/src/primitiveComponents/Input/Input.tsx index 9228ff19f..405416062 100644 --- a/packages/cyberstorm/src/primitiveComponents/Input/Input.tsx +++ b/packages/cyberstorm/src/primitiveComponents/Input/Input.tsx @@ -1,6 +1,5 @@ import React from "react"; import { PrimitiveComponentDefaultProps, TooltipWrapper } from "../utils/utils"; -import { classnames } from "../../utils/utils"; export interface InputTextInputProps extends React.InputHTMLAttributes, @@ -14,10 +13,6 @@ export const Input = React.forwardRef( children, primitiveType, rootClasses, - csTextStyles, - csColor, - csVariant, - csSize, tooltipText, tooltipSide, ...forwardedProps @@ -29,17 +24,7 @@ export const Input = React.forwardRef( return ( - + {children} diff --git a/packages/cyberstorm/src/primitiveComponents/utils/utils.tsx b/packages/cyberstorm/src/primitiveComponents/utils/utils.tsx index 9a8369b40..4a4c5bcf4 100644 --- a/packages/cyberstorm/src/primitiveComponents/utils/utils.tsx +++ b/packages/cyberstorm/src/primitiveComponents/utils/utils.tsx @@ -1,69 +1,6 @@ import { PropsWithChildren } from "react"; import { Tooltip } from "../.."; -// TODO: It would be nice if we forced storybook generation of all of the possible combinations. -// If we do that, we'll have to handle the "unsupported combinations" gracefully somehow. -// Best would be if we could have typescript warnings and force each "non-supported combination" to be explicitly -// unsupported. See NewButtons story in storybook for reference - -export type variants = - | "default" - | "defaultPeek" - | "primary" - | "secondary" - | "tertiary" - | "tertiaryDimmed" - | "minimal" - | "accent" - | "special"; - -export type colors = - | "surface" - | "surface-alpha" - | "blue" - | "pink" - | "red" - | "orange" - | "green" - | "yellow" - | "purple" - | "cyber-green"; -export const colorsList = [ - "surface", - "surface-alpha", - "blue", - "pink", - "red", - "orange", - "green", - "yellow", - "purple", - "cyber-green", -] as const; - -export type sizes = "xxs" | "xs" | "s" | "m" | "l"; - -export const textStyleOptions = [ - "lineHeightAuto", - "lineHeightBody", - "fontSizeXXS", - "fontSizeXS", - "fontSizeS", - "fontSizeM", - "fontSizeL", - "fontWeightRegular", - "fontWeightMedium", - "fontWeightSemiBold", - "fontWeightBold", - "fontFamilyInter", - "fontFamilyHubot", -] as const; - -// There is an issue with Typescript (eslint) and prettier disagreeing if -// the type should have parentheses -// prettier-ignore -export type TextStyles = (typeof textStyleOptions)[number]; - interface TooltipWrapperProps extends PropsWithChildren { tooltipText?: string; tooltipSide?: "bottom" | "left" | "right" | "top"; @@ -72,10 +9,6 @@ interface TooltipWrapperProps extends PropsWithChildren { export interface PrimitiveComponentDefaultProps extends PropsWithChildren, TooltipWrapperProps { - csColor?: colors; - csVariant?: variants; - csSize?: sizes; - csTextStyles?: TextStyles[]; rootClasses?: string; } diff --git a/packages/cyberstorm/src/utils/utils.ts b/packages/cyberstorm/src/utils/utils.ts index 5d832ab40..d7e0b297f 100644 --- a/packages/cyberstorm/src/utils/utils.ts +++ b/packages/cyberstorm/src/utils/utils.ts @@ -35,3 +35,12 @@ export const classnames = ( ): string => { return classnames.filter(String).join(" "); }; + +export const componentClasses = ( + variant: string, + size: string, + modifiers?: string[] +): string[] => { + const asd = modifiers ? modifiers?.map((csm) => `ts-modifier--${csm}`) : []; + return [`ts-variant--${variant}`, `ts-size--${size}`, ...asd]; +};