Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new design SA v2 #525

Draft
wants to merge 9 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 78 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"jsxBracketSameLine": true,
"arrowParens": "avoid",
"trailingComma": "all",
"xmlWhitespaceSensitivity": "ignore",
"endOfLine": "lf"
},
"stylelint": {
Expand Down Expand Up @@ -157,6 +158,7 @@
"wolfy87-eventemitter": "5.2.9"
},
"devDependencies": {
"@prettier/plugin-xml": "1.2.0",
"@storybook/addon-actions": "6.3.7",
"@storybook/addon-essentials": "6.3.7",
"@storybook/addon-links": "6.3.7",
Expand Down
32 changes: 3 additions & 29 deletions src/components/alert/index.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
import { ReactElement } from 'react';
import classNames from 'classnames';

import { ExternalLink, Link } from 'components/button';
import { Text } from 'components/custom/typography';
import { Icon, IconNames } from 'components/icon';

import s from './s.module.scss';

type RenderLinkProps = {
type?: 'link' | 'external';
href: string;
children: string;
};

const RenderLink: React.FC<RenderLinkProps> = ({ type = 'link', href, children }) => {
// TODO: switch to raw Link and 'a', style locally link color and hover
if (type === 'link') {
return (
<Link variation="link" to={href}>
{children}
</Link>
);
}

return (
<ExternalLink variation="link" href={href}>
{children}
</ExternalLink>
);
};

interface AlertPropsType {
type: 'info' | 'warning' | 'error';
className?: string;
title?: ReactElement;
link?: RenderLinkProps;
}

function getIconName(type: AlertPropsType['type']): IconNames {
Expand All @@ -48,22 +23,21 @@ function getIconName(type: AlertPropsType['type']): IconNames {
}
}

export const Alert: React.FC<AlertPropsType> = ({ type, className, children, title, link }) => {
export const Alert: React.FC<AlertPropsType> = ({ type, className, children, title }) => {
return (
<div className={classNames(s.alert, s[type], className)}>
<Icon name={getIconName(type)} size={24} className="mr-16" />
<div>
{title ? (
<Text type="p2" weight="bold" className="mb-4">
<Text type="body1" weight="semibold" className="mb-4">
{title}
</Text>
) : null}
{children ? (
<Text type="p2" weight="semibold">
<Text type="body2" weight="medium">
{children}
</Text>
) : null}
{link ? <RenderLink {...link} /> : null}
</div>
</div>
);
Expand Down
14 changes: 5 additions & 9 deletions src/components/alert/s.module.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.alert {
font: var(--font-p2);
font-weight: 600;
font: var(--font-body2-medium);
padding: 16px 24px;
display: flex;
border-radius: 4px;
border-radius: 8px;

a {
color: inherit;
Expand All @@ -12,19 +11,16 @@
}

.info {
background: rgba(79, 106, 229, 0.04);
border: 1px solid rgba(79, 106, 229, 0.32);
background: rgba(68, 139, 244, 0.08);
color: var(--theme-blue-color);
}

.warning {
background: rgba(var(--theme-yellow-color-rgb), 0.04);
border: 1px solid rgba(var(--theme-yellow-color-rgb), 0.32);
background: rgba(255, 167, 64, 0.08);
color: var(--theme-yellow-color);
}

.error {
background: rgba(var(--theme-red-color-rgb), 0.04);
border: 1px solid rgba(204, 167, 77, 0.32);
background: rgba(255, 67, 57, 0.08);
color: var(--theme-red-color);
}
2 changes: 1 addition & 1 deletion src/components/antd/alert/s.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

> :global(.ant-alert-content) {
font: var(--font-p2);
font: var(--font-body2);
font-weight: 600;
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/antd/button/s.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
}

.component:global(.ant-btn) {
font: var(--font-p2);
font: var(--font-body2);
font-weight: bold;
display: flex;
align-items: center;
Expand All @@ -132,14 +132,14 @@
text-align: center;

&:global(.ant-btn-lg) {
font: var(--font-p1);
font: var(--font-body1);
font-weight: bold;
height: 64px;
padding: 20px;
}

&:global(.ant-btn-sm) {
font: var(--font-sm);
font: var(--font-caption);
font-weight: bold;
height: 34px;
padding: 9px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/antd/datepicker/s.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

:global(.ant-picker-input) {
input {
font: var(--font-p1);
font: var(--font-body1);
font-weight: 600;
color: var(--theme-primary-color);

Expand Down
2 changes: 1 addition & 1 deletion src/components/antd/field-label/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const FieldLabel: FCx<FieldLabelProps> = props => {
<div className="flex flow-col col-gap-4 align-center">
<Hint text={hint}>
{typeof label === 'string' ? (
<Text type="small" weight="semibold" color="secondary">
<Text type="caption" weight="semibold" color="secondary">
{label}
</Text>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/components/antd/form/s.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
margin-bottom: 0;

:global(.ant-form-item-label) label {
font: var(--font-sm);
font: var(--font-caption);
font-weight: 600;
display: inline-grid;
grid-template-columns: repeat(2, max-content);
Expand Down
Loading