mirror of
https://github.com/LukeHagar/firecamp.git
synced 2025-12-10 12:27:45 +00:00
ui(MButton): updated props
This commit is contained in:
@@ -124,8 +124,8 @@ const GlobalCreateDD = ({}) => {
|
|||||||
<Button
|
<Button
|
||||||
text={'Create'}
|
text={'Create'}
|
||||||
rightIcon={<VscTriangleDown size={12} className={classnames({'transform rotate-180': isOpen})}/>}
|
rightIcon={<VscTriangleDown size={12} className={classnames({'transform rotate-180': isOpen})}/>}
|
||||||
withoutBorder
|
|
||||||
transparent
|
transparent
|
||||||
|
primary
|
||||||
compact
|
compact
|
||||||
xs
|
xs
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ const EnvironmentDD: FC<IEnvironmentDD> = ({ onChange = () => {} }) => {
|
|||||||
className={cx({ 'transform rotate-180': isOpen })}
|
className={cx({ 'transform rotate-180': isOpen })}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
withoutBorder
|
|
||||||
transparent
|
transparent
|
||||||
compact
|
compact
|
||||||
xs
|
xs
|
||||||
|
|||||||
@@ -225,11 +225,11 @@ const Globals = () => {
|
|||||||
{ id: env.__ref.id, type: ETabEntityTypes.Environment }
|
{ id: env.__ref.id, type: ETabEntityTypes.Environment }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
//TODO: fix height for tree item
|
|
||||||
return (
|
return (
|
||||||
<div className="rct-tree-item-li focus:rct-tree-item-li-focused border-b border-app-border">
|
<div className="rct-tree-item-li focus:rct-tree-item-li-focused border-b border-app-border">
|
||||||
<div className="px-2 mt-5 mb-1 rct-tree-item-title-container focus:rct-tree-item-title-container-focused hover:rct-tree-item-title-container-focused !opacity-100 cursor-pointer">
|
<div className="px-2 mt-5 mb-1 rct-tree-item-title-container focus:rct-tree-item-title-container-focused hover:rct-tree-item-title-container-focused !opacity-100 cursor-pointer">
|
||||||
<VscJson className="flex-none" size={18} opacity={1} />
|
<VscJson className="flex-none my-0.5" size={18} opacity={1} />
|
||||||
<span className="w-full overflow-hidden text-ellipsis items-center block pl-1 text-base">
|
<span className="w-full overflow-hidden text-ellipsis items-center block pl-1 text-base">
|
||||||
{globalEnv?.name}
|
{globalEnv?.name}
|
||||||
</span>
|
</span>
|
||||||
@@ -240,8 +240,8 @@ const Globals = () => {
|
|||||||
classNames={{
|
classNames={{
|
||||||
root: 'hover:!bg-focusColor !text-app-foreground-inactive'
|
root: 'hover:!bg-focusColor !text-app-foreground-inactive'
|
||||||
}}
|
}}
|
||||||
compact
|
|
||||||
ghost
|
ghost
|
||||||
|
compact
|
||||||
xs
|
xs
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -194,11 +194,13 @@ export default {
|
|||||||
console.log(1234)
|
console.log(1234)
|
||||||
}}/> */}
|
}}/> */}
|
||||||
|
|
||||||
{/* //TODO: find & check usage */}
|
{/* TODO: check preview */}
|
||||||
{item.data.__ref.isEnvironment ? (
|
{ item.data.__ref.isEnvironment ? (
|
||||||
<Button
|
<Button
|
||||||
text={'Clone'}
|
text={'Clone'}
|
||||||
className="hover:!bg-focus2 ml-1 !text-app-foreground-inactive !py-0"
|
classNames={{
|
||||||
|
root:'hover:!bg-focus2 ml-1 !text-app-foreground-inactive !py-0'
|
||||||
|
}}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -210,10 +212,8 @@ export default {
|
|||||||
item.data.__ref.id
|
item.data.__ref.id
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
transparent
|
|
||||||
secondary
|
|
||||||
ghost
|
ghost
|
||||||
sm
|
xs
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
|
|||||||
@@ -178,8 +178,8 @@ const EnvironmentTab = ({ tab, platformContext: context }) => {
|
|||||||
<VscEdit size={12} onClick={rename} className="pointer" />
|
<VscEdit size={12} onClick={rename} className="pointer" />
|
||||||
</TabHeader.Left>
|
</TabHeader.Left>
|
||||||
<TabHeader.Right>
|
<TabHeader.Right>
|
||||||
{/* <Button text="Save" primary sm /> */}
|
{/* <Button text="Save" primary xs /> */}
|
||||||
{/* <Button text="Delete" secondary sm disabled={false} /> */}
|
{/* <Button text="Delete" secondary xs disabled={false} /> */}
|
||||||
</TabHeader.Right>
|
</TabHeader.Right>
|
||||||
</TabHeader>
|
</TabHeader>
|
||||||
</Container.Header>
|
</Container.Header>
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ const ForgotPassword: FC<IModal> = ({ isOpen = false, onClose = () => {} }) => {
|
|||||||
<Button
|
<Button
|
||||||
text={isRequesting ? `Sending...` : `Send`}
|
text={isRequesting ? `Sending...` : `Send`}
|
||||||
onClick={handleSubmit(_onSubmit)}
|
onClick={handleSubmit(_onSubmit)}
|
||||||
fullWidth={true}
|
fullWidth
|
||||||
primary
|
primary
|
||||||
md
|
sm
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -105,20 +105,21 @@ const GithubGoogleAuth: FC<IGithubGoogleAuth> = ({ onClose }) => {
|
|||||||
<div className="">
|
<div className="">
|
||||||
{/* <Button
|
{/* <Button
|
||||||
text="Continue with Google"
|
text="Continue with Google"
|
||||||
icon={<GrGoogle size={18} />}
|
leftIcon={<GrGoogle size={18} />}
|
||||||
className="!w-full mb-5"
|
className="mb-5"
|
||||||
onClick={_googleOAuth}
|
onClick={_googleOAuth}
|
||||||
|
fullWidth
|
||||||
transparent
|
transparent
|
||||||
iconLeft
|
sm
|
||||||
md
|
|
||||||
/> */}
|
/> */}
|
||||||
<Button
|
<Button
|
||||||
text="Continue with Github"
|
text="Continue with Github"
|
||||||
icon={<VscGithub size={18} />}
|
leftIcon={<VscGithub size={18} />}
|
||||||
className="!w-full mb-5"
|
classNames={{ root: 'mb-5' }}
|
||||||
onClick={_githubOAuth}
|
onClick={_githubOAuth}
|
||||||
iconLeft
|
outline
|
||||||
md
|
fullWidth
|
||||||
|
sm
|
||||||
/>
|
/>
|
||||||
{/* <a
|
{/* <a
|
||||||
href="#"
|
href="#"
|
||||||
|
|||||||
@@ -136,12 +136,12 @@ const Body: FC<any> = ({ onClose = () => {} }) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* TODO: check preview */}
|
||||||
<Button
|
<Button
|
||||||
color="primary"
|
|
||||||
text="Sign in"
|
text="Sign in"
|
||||||
fullWidth={true}
|
|
||||||
size="md"
|
|
||||||
onClick={handleSubmit(_onSubmit)}
|
onClick={handleSubmit(_onSubmit)}
|
||||||
|
fullWidth
|
||||||
|
sm
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -129,12 +129,13 @@ const ResetPassword: FC<IModal> = ({ isOpen = false, onClose = () => {} }) => {
|
|||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
{/* TODO: check preview */}
|
||||||
<Button
|
<Button
|
||||||
text={isRequesting ? `Resetting password...` : 'Reset Password'}
|
text={isRequesting ? `Resetting password...` : 'Reset Password'}
|
||||||
onClick={handleSubmit(_onSubmit)}
|
onClick={handleSubmit(_onSubmit)}
|
||||||
fullWidth={true}
|
fullWidth
|
||||||
primary
|
primary
|
||||||
md
|
sm
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ const SignIn: FC<IModal> = () => {
|
|||||||
<GithubGoogleAuth />
|
<GithubGoogleAuth />
|
||||||
<Button
|
<Button
|
||||||
text="Continue with Email"
|
text="Continue with Email"
|
||||||
icon={<VscAccount size={18} />}
|
leftIcon={<VscAccount size={18} />}
|
||||||
className="!w-full mb-5"
|
className="mb-5"
|
||||||
onClick={() => platformContext.app.modals.openSignInWithEmail()}
|
onClick={() => platformContext.app.modals.openSignInWithEmail()}
|
||||||
transparent
|
outline
|
||||||
iconLeft
|
fullWidth
|
||||||
md
|
sm
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="mb-8 mt-8 flex justify-center items-center">
|
{/* <div className="mb-8 mt-8 flex justify-center items-center">
|
||||||
|
|||||||
@@ -154,11 +154,12 @@ const SignInWithEmail: FC<IModal> = () => {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
|
type="submit"
|
||||||
text={isRequesting ? `Singing...` : `Sign in`}
|
text={isRequesting ? `Singing...` : `Sign in`}
|
||||||
onClick={handleSubmit(_onSignIn)}
|
onClick={handleSubmit(_onSignIn)}
|
||||||
fullWidth={true}
|
fullWidth
|
||||||
primary
|
primary
|
||||||
md
|
sm
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -164,11 +164,12 @@ const SignUp: FC<IModal> = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
type="submit"
|
||||||
text={isRequesting ? 'Signing up...' : 'Sign up'}
|
text={isRequesting ? 'Signing up...' : 'Sign up'}
|
||||||
onClick={handleSubmit(_onSignUp)}
|
onClick={handleSubmit(_onSignUp)}
|
||||||
fullWidth={true}
|
fullWidth
|
||||||
primary
|
primary
|
||||||
md
|
sm
|
||||||
/>
|
/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ import '../sass/_index.sass';
|
|||||||
|
|
||||||
import { FC, useEffect, useState } from 'react';
|
import { FC, useEffect, useState } from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
import { Row, RootContainer, EditorApi, FirecampThemeProvider } from '@firecamp/ui';
|
import {
|
||||||
|
Row,
|
||||||
|
RootContainer,
|
||||||
|
EditorApi,
|
||||||
|
FirecampThemeProvider,
|
||||||
|
} from '@firecamp/ui';
|
||||||
import { EFirecampAgent } from '@firecamp/types';
|
import { EFirecampAgent } from '@firecamp/types';
|
||||||
import { _misc } from '@firecamp/utils';
|
import { _misc } from '@firecamp/utils';
|
||||||
|
|
||||||
@@ -23,6 +28,7 @@ import ErrorPopup from '../components/common/error-boundary/ErrorPopup';
|
|||||||
import RealtimeEventManager from '../components/common/realtime/Realtime';
|
import RealtimeEventManager from '../components/common/realtime/Realtime';
|
||||||
import platformContext from '../services/platform-context';
|
import platformContext from '../services/platform-context';
|
||||||
import { EFirecampThemeVariant } from '@firecamp/ui/src/components/theme/FirecampThemeProvider.interfaces';
|
import { EFirecampThemeVariant } from '@firecamp/ui/src/components/theme/FirecampThemeProvider.interfaces';
|
||||||
|
import FirecampThemeSelector from '@firecamp/ui/src/components/theme/FirecampThemeSelector';
|
||||||
|
|
||||||
// Initialise Firecamp languages settings
|
// Initialise Firecamp languages settings
|
||||||
EditorApi.init();
|
EditorApi.init();
|
||||||
@@ -45,7 +51,7 @@ const App: FC<any> = () => {
|
|||||||
else alert('I am unmounting');
|
else alert('I am unmounting');
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
const [theme, updateTheme] = useState(EFirecampThemeVariant.LightSecondary);
|
const [theme, updateTheme] = useState(EFirecampThemeVariant.LightPrimary);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
@@ -55,21 +61,26 @@ const App: FC<any> = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FirecampThemeProvider themeVariant={theme}>
|
<FirecampThemeProvider themeVariant={theme}>
|
||||||
<RootContainer
|
<RootContainer
|
||||||
flex={1}
|
flex={1}
|
||||||
overflow="auto"
|
overflow="auto"
|
||||||
className="h-screen w-screen bg-app-background text-app-foreground"
|
className="h-screen w-screen bg-app-background text-app-foreground"
|
||||||
>
|
>
|
||||||
<Row flex={1}>
|
<Row flex={1}>
|
||||||
<SidebarContainer />
|
<SidebarContainer />
|
||||||
<TabsContainer />
|
<TabsContainer />
|
||||||
</Row>
|
</Row>
|
||||||
|
<FirecampThemeSelector
|
||||||
|
theme={theme}
|
||||||
|
updateCurrentTheme={updateTheme}
|
||||||
|
/>
|
||||||
|
|
||||||
<RealtimeEventManager />
|
<RealtimeEventManager />
|
||||||
<ModalContainer />
|
<ModalContainer />
|
||||||
<EnvSidebarContainer />
|
<EnvSidebarContainer />
|
||||||
<StatusBarContainer className="border-t focus-outer2" />
|
|
||||||
</RootContainer>
|
<StatusBarContainer className="border-t focus-outer2" />
|
||||||
|
</RootContainer>
|
||||||
</FirecampThemeProvider>
|
</FirecampThemeProvider>
|
||||||
<Crisp />
|
<Crisp />
|
||||||
<Analytics />
|
<Analytics />
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ export interface IButton extends ButtonProps {
|
|||||||
/** button text to show */
|
/** button text to show */
|
||||||
text?: string;
|
text?: string;
|
||||||
|
|
||||||
/** text uppercase*/
|
|
||||||
uppercase?: boolean;
|
|
||||||
|
|
||||||
/** primary button */
|
/** primary button */
|
||||||
primary?: boolean;
|
primary?: boolean;
|
||||||
/** ghost button */
|
/** ghost button */
|
||||||
@@ -17,8 +14,7 @@ export interface IButton extends ButtonProps {
|
|||||||
danger?: boolean;
|
danger?: boolean;
|
||||||
/** transparent button */
|
/** transparent button */
|
||||||
transparent?: boolean;
|
transparent?: boolean;
|
||||||
/** to create a transparent button without border & background transparent on hover */
|
outline?: boolean;
|
||||||
withoutBorder?: boolean;
|
|
||||||
|
|
||||||
/** extra small size */
|
/** extra small size */
|
||||||
xs?: boolean;
|
xs?: boolean;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const TemplateWithVariant = ({ variant }: { variant: btnType[] }) => (
|
|||||||
export const PrimaryButton = Template.bind({});
|
export const PrimaryButton = Template.bind({});
|
||||||
PrimaryButton.args = {
|
PrimaryButton.args = {
|
||||||
text: 'Primary Button',
|
text: 'Primary Button',
|
||||||
md: true,
|
sm: true,
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.PrimaryButton {...ButtonStories.PrimaryButton.args} />
|
<ButtonStories.PrimaryButton {...ButtonStories.PrimaryButton.args} />
|
||||||
),
|
),
|
||||||
@@ -51,7 +51,7 @@ export const SecondaryButton = Template.bind({});
|
|||||||
SecondaryButton.args = {
|
SecondaryButton.args = {
|
||||||
text: 'Secondary Button',
|
text: 'Secondary Button',
|
||||||
secondary: true,
|
secondary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.SecondaryButton {...ButtonStories.SecondaryButton.args} />
|
<ButtonStories.SecondaryButton {...ButtonStories.SecondaryButton.args} />
|
||||||
),
|
),
|
||||||
@@ -61,7 +61,7 @@ export const DangerButton = Template.bind({});
|
|||||||
DangerButton.args = {
|
DangerButton.args = {
|
||||||
text: 'Danger Button',
|
text: 'Danger Button',
|
||||||
danger: true,
|
danger: true,
|
||||||
md: true,
|
sm: true,
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.DangerButton {...ButtonStories.DangerButton.args} />
|
<ButtonStories.DangerButton {...ButtonStories.DangerButton.args} />
|
||||||
),
|
),
|
||||||
@@ -71,7 +71,7 @@ export const FullWidthButton = Template.bind({});
|
|||||||
FullWidthButton.args = {
|
FullWidthButton.args = {
|
||||||
text: 'FullWidth Button',
|
text: 'FullWidth Button',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
fullWidth: true,
|
fullWidth: true,
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.FullWidthButton {...ButtonStories.FullWidthButton.args} />
|
<ButtonStories.FullWidthButton {...ButtonStories.FullWidthButton.args} />
|
||||||
@@ -93,7 +93,7 @@ export const GhostButton = Template.bind({});
|
|||||||
GhostButton.args = {
|
GhostButton.args = {
|
||||||
text: 'Ghost Button',
|
text: 'Ghost Button',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
ghost: true,
|
ghost: true,
|
||||||
previewBtn: <ButtonStories.GhostButton {...ButtonStories.GhostButton.args} />,
|
previewBtn: <ButtonStories.GhostButton {...ButtonStories.GhostButton.args} />,
|
||||||
};
|
};
|
||||||
@@ -112,7 +112,7 @@ export const ButtonIcon = Template.bind({});
|
|||||||
ButtonIcon.args = {
|
ButtonIcon.args = {
|
||||||
text: 'Sample Button...',
|
text: 'Sample Button...',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
leftIcon: <VscMenu title="Account" size={16} className="z-20" />,
|
leftIcon: <VscMenu title="Account" size={16} className="z-20" />,
|
||||||
previewBtn: <ButtonStories.ButtonIcon {...ButtonStories.ButtonIcon.args} />,
|
previewBtn: <ButtonStories.ButtonIcon {...ButtonStories.ButtonIcon.args} />,
|
||||||
};
|
};
|
||||||
@@ -121,7 +121,7 @@ export const CaretButton = Template.bind({});
|
|||||||
CaretButton.args = {
|
CaretButton.args = {
|
||||||
text: 'Button with caret icon',
|
text: 'Button with caret icon',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
rightIcon: <VscTriangleDown size={12} />,
|
rightIcon: <VscTriangleDown size={12} />,
|
||||||
previewBtn: <ButtonStories.CaretButton {...ButtonStories.CaretButton.args} />,
|
previewBtn: <ButtonStories.CaretButton {...ButtonStories.CaretButton.args} />,
|
||||||
};
|
};
|
||||||
@@ -130,7 +130,7 @@ export const ButtonWithToolTip = Template.bind({});
|
|||||||
ButtonWithToolTip.args = {
|
ButtonWithToolTip.args = {
|
||||||
text: 'Button with tooltip',
|
text: 'Button with tooltip',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
title: 'tooltiptext',
|
title: 'tooltiptext',
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.ButtonWithToolTip
|
<ButtonStories.ButtonWithToolTip
|
||||||
@@ -143,7 +143,7 @@ export const ButtonWithAdditionalDomProp = Template.bind({});
|
|||||||
ButtonWithAdditionalDomProp.args = {
|
ButtonWithAdditionalDomProp.args = {
|
||||||
text: 'Additional Button Prop',
|
text: 'Additional Button Prop',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
'test-id': 'testing-mantine-btn',
|
'test-id': 'testing-mantine-btn',
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.ButtonWithAdditionalDomProp
|
<ButtonStories.ButtonWithAdditionalDomProp
|
||||||
@@ -156,7 +156,7 @@ export const ButtonWithUpperCaseText = Template.bind({});
|
|||||||
ButtonWithUpperCaseText.args = {
|
ButtonWithUpperCaseText.args = {
|
||||||
text: 'Button with uppercase text',
|
text: 'Button with uppercase text',
|
||||||
primary: true,
|
primary: true,
|
||||||
md: true,
|
sm: true,
|
||||||
uppercase: true,
|
uppercase: true,
|
||||||
previewBtn: (
|
previewBtn: (
|
||||||
<ButtonStories.ButtonWithUpperCaseText
|
<ButtonStories.ButtonWithUpperCaseText
|
||||||
@@ -175,6 +175,8 @@ export const ButtonVariant = () => {
|
|||||||
{ text: 'Danger Button', danger: true, md: true },
|
{ text: 'Danger Button', danger: true, md: true },
|
||||||
{ text: 'Ghost Button', ghost: true, md: true },
|
{ text: 'Ghost Button', ghost: true, md: true },
|
||||||
{ text: 'Transparent Button', transparent: true, md: true },
|
{ text: 'Transparent Button', transparent: true, md: true },
|
||||||
|
{ text: 'Outlined Button', outline: true, primary: true,sm: true },
|
||||||
|
{ text: 'Outlined Button', outline: true, sm: true },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<TemplateWithVariant
|
<TemplateWithVariant
|
||||||
@@ -194,6 +196,8 @@ export const ButtonVariant = () => {
|
|||||||
md: true,
|
md: true,
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
|
{ text: 'Outlined Button', outline: true, primary: true, sm: true, disabled: true, },
|
||||||
|
{ text: 'Outlined Button', outline: true, sm: true, disabled: true, },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,45 +3,61 @@ import { Button as MantineButton, createStyles } from '@mantine/core';
|
|||||||
import { IButton } from './MButton.interfaces';
|
import { IButton } from './MButton.interfaces';
|
||||||
|
|
||||||
// custom styles for variants
|
// custom styles for variants
|
||||||
const useStyles = createStyles((theme) => ({
|
const useStyles = createStyles((theme, { variant, color }: IButton) => ({
|
||||||
dangerVariant: {
|
root: {
|
||||||
color: theme.white,
|
display: 'flex',
|
||||||
backgroundColor: theme.colors.red[theme.colorScheme === 'light' ? 6 : 8],
|
...(variant === 'outline'
|
||||||
':hover': {
|
? {
|
||||||
backgroundColor: theme.colors.red[theme.colorScheme === 'light' ? 7 : 9],
|
color:
|
||||||
|
color === 'primaryColor'
|
||||||
|
? theme.colors[theme.primaryColor][
|
||||||
|
theme.colorScheme === 'light' ? 6 : 8
|
||||||
|
]
|
||||||
|
: theme.colors[color][theme.colorScheme === 'light' ? 6 : 0],
|
||||||
|
borderColor:
|
||||||
|
color === 'primaryColor'
|
||||||
|
? theme.colors[theme.primaryColor][
|
||||||
|
theme.colorScheme === 'light' ? 6 : 8
|
||||||
|
]
|
||||||
|
: theme.colors[color][theme.colorScheme === 'light' ? 6 : 0],
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
'&:disabled, &[data-disabled]': {
|
||||||
|
color:
|
||||||
|
variant === 'filled'
|
||||||
|
? theme.white
|
||||||
|
: color === 'primaryColor'
|
||||||
|
? theme.colors[theme.primaryColor][
|
||||||
|
theme.colorScheme === 'light' ? 6 : 8
|
||||||
|
]
|
||||||
|
: theme.colors[color][theme.colorScheme === 'light' ? 6 : 8],
|
||||||
|
backgroundColor:
|
||||||
|
variant === 'filled'
|
||||||
|
? color === 'primaryColor'
|
||||||
|
? theme.colors[theme.primaryColor][
|
||||||
|
theme.colorScheme === 'light' ? 6 : 8
|
||||||
|
]
|
||||||
|
: theme.colors[color][theme.colorScheme === 'light' ? 6 : 8]
|
||||||
|
: 'transparent',
|
||||||
|
...(variant === 'outline'
|
||||||
|
? {
|
||||||
|
color:
|
||||||
|
color === 'primaryColor'
|
||||||
|
? theme.colors[theme.primaryColor][
|
||||||
|
theme.colorScheme === 'light' ? 6 : 8
|
||||||
|
]
|
||||||
|
: theme.colors[color][theme.colorScheme === 'light' ? 6 : 0],
|
||||||
|
borderColor:
|
||||||
|
color === 'primaryColor'
|
||||||
|
? theme.colors[theme.primaryColor][
|
||||||
|
theme.colorScheme === 'light' ? 6 : 8
|
||||||
|
]
|
||||||
|
: theme.colors[color][theme.colorScheme === 'light' ? 6 : 0],
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dangerButton: {
|
transparent: {
|
||||||
color: theme.white,
|
|
||||||
backgroundColor: theme.colors.red[6],
|
|
||||||
},
|
|
||||||
ghostButton: {
|
|
||||||
color: theme.colors[theme.primaryColor][6],
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
},
|
|
||||||
primaryButton: {
|
|
||||||
color: theme.white,
|
|
||||||
backgroundColor: theme.colors[theme.primaryColor][6],
|
|
||||||
},
|
|
||||||
secondaryVariant: {
|
|
||||||
backgroundColor: theme.colors.dark[6],
|
|
||||||
color: theme.colors.dark[0],
|
|
||||||
':hover': {
|
|
||||||
backgroundColor: theme.colors.dark[7],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
secondaryButton: {
|
|
||||||
color: theme.colors.dark[0],
|
|
||||||
backgroundColor: theme.colors.dark[6],
|
|
||||||
},
|
|
||||||
transparentButton: {
|
|
||||||
color: theme.colors[theme.primaryColor][6],
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
borderColor: theme.colors[theme.primaryColor][6],
|
|
||||||
},
|
|
||||||
withoutBorderVariant: {
|
|
||||||
backgroundColor: 'transparent',
|
|
||||||
borderColor: 'transparent',
|
|
||||||
':hover': {
|
':hover': {
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
},
|
},
|
||||||
@@ -53,13 +69,11 @@ const useStyles = createStyles((theme) => ({
|
|||||||
// TODO: update tooltip prop usage by providing title={tooltip}
|
// TODO: update tooltip prop usage by providing title={tooltip}
|
||||||
// TODO: update iconLeft,iconRight,icon prop usage by providing leftIcon={<Icon/> & rightIcon={<Icon/>
|
// TODO: update iconLeft,iconRight,icon prop usage by providing leftIcon={<Icon/> & rightIcon={<Icon/>
|
||||||
// TODO: update all sizes props [xs, sm, md, lg] according to mantine props - adding compact prop for xs
|
// TODO: update all sizes props [xs, sm, md, lg] according to mantine props - adding compact prop for xs
|
||||||
// TODO: should keep primary prompt ??
|
// TODO: discuss should keep primary prompt ?? currently used with outline prop
|
||||||
enum EVariant {
|
enum EVariant {
|
||||||
danger = 'danger', //custom variant
|
|
||||||
primary = 'filled',
|
primary = 'filled',
|
||||||
ghost = 'subtle',
|
ghost = 'subtle',
|
||||||
secondary = 'white',
|
outline = 'outline',
|
||||||
transparent = 'outline',
|
|
||||||
}
|
}
|
||||||
enum ESize {
|
enum ESize {
|
||||||
xs = 'xs',
|
xs = 'xs',
|
||||||
@@ -79,7 +93,7 @@ const Button: FC<IButton> = ({
|
|||||||
secondary = false,
|
secondary = false,
|
||||||
danger = false,
|
danger = false,
|
||||||
transparent = false,
|
transparent = false,
|
||||||
withoutBorder = false,
|
outline = false,
|
||||||
|
|
||||||
xs = false,
|
xs = false,
|
||||||
sm = false,
|
sm = false,
|
||||||
@@ -87,19 +101,13 @@ const Button: FC<IButton> = ({
|
|||||||
lg = false,
|
lg = false,
|
||||||
|
|
||||||
text,
|
text,
|
||||||
uppercase = false,
|
|
||||||
|
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const { classes, cx } = useStyles();
|
|
||||||
|
|
||||||
// default variant if not passed is primary
|
// default variant if not passed is primary
|
||||||
const customVariant =
|
const customVariant =
|
||||||
(danger && EVariant.primary) ||
|
((danger || secondary) && EVariant.primary) ||
|
||||||
(ghost && EVariant.ghost) ||
|
((ghost || transparent) && EVariant.ghost) ||
|
||||||
(primary && EVariant.primary) ||
|
(outline && EVariant.outline) ||
|
||||||
(secondary && EVariant.secondary) ||
|
|
||||||
(transparent && EVariant.transparent) ||
|
|
||||||
variant;
|
variant;
|
||||||
|
|
||||||
// default size if not passed is sm
|
// default size if not passed is sm
|
||||||
@@ -110,42 +118,30 @@ const Button: FC<IButton> = ({
|
|||||||
(lg && ESize.lg) ||
|
(lg && ESize.lg) ||
|
||||||
size;
|
size;
|
||||||
|
|
||||||
|
// default size if not passed is sm
|
||||||
|
const customColor = danger
|
||||||
|
? 'red'
|
||||||
|
: secondary || (outline && !primary)
|
||||||
|
? 'gray'
|
||||||
|
: 'primaryColor';
|
||||||
|
const { classes, cx } = useStyles({
|
||||||
|
variant: customVariant ?? 'filled',
|
||||||
|
color: customColor,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MantineButton
|
<MantineButton
|
||||||
size={customSize}
|
size={customSize}
|
||||||
variant={customVariant}
|
variant={customVariant}
|
||||||
|
color={customColor}
|
||||||
classNames={{
|
classNames={{
|
||||||
...classNames,
|
...classNames,
|
||||||
root: cx(
|
root: cx(
|
||||||
'flex',
|
|
||||||
classNames.root,
|
classNames.root,
|
||||||
{ [classes.withoutBorderVariant]: withoutBorder },
|
classes.root,
|
||||||
{ [classes.dangerVariant]: danger },
|
{ [classes.transparent]: transparent },
|
||||||
{ [classes.secondaryVariant]: customVariant === EVariant.secondary }
|
{ 'justify-center': props.fullWidth }
|
||||||
),
|
),
|
||||||
label: cx(classNames.label, { uppercase: uppercase }),
|
|
||||||
}}
|
|
||||||
styles={{
|
|
||||||
root: {
|
|
||||||
'&:disabled, &[data-disabled]': cx(
|
|
||||||
{
|
|
||||||
[classes.dangerButton]: danger,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[classes.ghostButton]: customVariant === EVariant.ghost,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[classes.primaryButton]: customVariant === EVariant.primary,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[classes.secondaryButton]: customVariant === EVariant.secondary,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
[classes.transparentButton]:
|
|
||||||
customVariant === EVariant.transparent,
|
|
||||||
}
|
|
||||||
),
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
@@ -154,3 +150,8 @@ const Button: FC<IButton> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default Button;
|
export default Button;
|
||||||
|
|
||||||
|
// possible variants
|
||||||
|
// root: '!text-info',
|
||||||
|
// root: 'hover:!bg-focusColor !text-app-foreground-inactive'
|
||||||
|
// className="hover:!bg-focus2 ml-1 !text-app-foreground-inactive !py-0"
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import {
|
|||||||
const primaryColor: ColorType = [
|
const primaryColor: ColorType = [
|
||||||
'#EEE8E2',
|
'#EEE8E2',
|
||||||
'#E1D3C5',
|
'#E1D3C5',
|
||||||
'#D6C0A9',
|
'#D6C0A9', // dark mode color index [in ghost variant]
|
||||||
'#D0AE8D',
|
'#D0AE8D',
|
||||||
'#CD9F70',
|
'#CD9F70',
|
||||||
'#CE9052',
|
'#CE9052',
|
||||||
'#D48332', // light theme color index
|
'#D48332', // light theme bgcolor index
|
||||||
'#B87634',
|
'#B87634',
|
||||||
'#9D6A37', // dark theme color index
|
'#9D6A37', // dark theme color index
|
||||||
'#875F38',
|
'#875F38',
|
||||||
@@ -22,7 +22,7 @@ const primaryColor: ColorType = [
|
|||||||
const secondaryColor: ColorType = [
|
const secondaryColor: ColorType = [
|
||||||
'#B4D1BE',
|
'#B4D1BE',
|
||||||
'#9CC7A9',
|
'#9CC7A9',
|
||||||
'#83BF96',
|
'#83BF96', // dark mode color index [in ghost variant]
|
||||||
'#6ABB84',
|
'#6ABB84',
|
||||||
'#50BA72',
|
'#50BA72',
|
||||||
'#3CB663',
|
'#3CB663',
|
||||||
@@ -33,18 +33,31 @@ const secondaryColor: ColorType = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const darkModeColor: ColorType = [
|
const darkModeColor: ColorType = [
|
||||||
'#fff', //text color
|
'#d5d7e0',
|
||||||
'#acaebf',
|
'#acaebf',
|
||||||
'#8c8fa3',
|
'#8c8fa3',
|
||||||
'#666980',
|
'#666980',
|
||||||
'#4d4f66', // for disabled value
|
'#4d4f66', // for disabled value
|
||||||
'#34354a',
|
'#34354a',
|
||||||
'#3c3c3c', // same color for both light & dark theme variant //'#2b2c3d'
|
'#2b2c3d', // same color for both light & dark theme variant
|
||||||
'#2d2c2c', //body background color
|
'#1d1e30', //body background color
|
||||||
'#0c0d21',
|
'#0c0d21',
|
||||||
'#01010a',
|
'#01010a',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const grayColor: ColorType = [
|
||||||
|
'#CCCCCC',
|
||||||
|
'#616161',
|
||||||
|
'#585858',
|
||||||
|
'#505050',
|
||||||
|
'#494949',
|
||||||
|
'#424242', //outline-dark
|
||||||
|
'#3C3C3C', //outline-light
|
||||||
|
'#363636',
|
||||||
|
'#313131',
|
||||||
|
'#2C2C2C',
|
||||||
|
];
|
||||||
|
|
||||||
const FirecampThemeProvider: FC<IFirecampThemeProvider> = ({
|
const FirecampThemeProvider: FC<IFirecampThemeProvider> = ({
|
||||||
themeVariant,
|
themeVariant,
|
||||||
children,
|
children,
|
||||||
@@ -85,6 +98,7 @@ const FirecampThemeProvider: FC<IFirecampThemeProvider> = ({
|
|||||||
colors: {
|
colors: {
|
||||||
'primary-color': themeColor,
|
'primary-color': themeColor,
|
||||||
dark: darkModeColor,
|
dark: darkModeColor,
|
||||||
|
gray: grayColor,
|
||||||
},
|
},
|
||||||
primaryColor: 'primary-color',
|
primaryColor: 'primary-color',
|
||||||
fontFamily: " 'Lato', 'sans-serif' ",
|
fontFamily: " 'Lato', 'sans-serif' ",
|
||||||
|
|||||||
@@ -510,6 +510,16 @@
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
.my-0{
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
|
||||||
|
}
|
||||||
|
.my-0\.5{
|
||||||
|
margin-top: 0.125rem;
|
||||||
|
margin-bottom: 0.125rem;
|
||||||
|
|
||||||
}
|
}
|
||||||
.my-1{
|
.my-1{
|
||||||
margin-top: 0.25rem;
|
margin-top: 0.25rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user