Skip to content

Commit

Permalink
remove string input for icon size
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Nov 29, 2023
1 parent a9aeee4 commit dfe1327
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const BreadCrumb = ({
<div className="md:container flex items-center gap-2 md:gap-4 bg-backgroundSolidDefault md:bg-transparent">
<Link href={backUrl} className="mt-5 hidden md:block">
<Text visuallyHidden>Go to State Page</Text>
<Icon filled source={Icons.leftFilled} size={24} />
<Icon source={Icons.leftFilled} size={24} />
</Link>
<div className="hidden md:block mt-4">
<Breadcrumbs crumbs={crumbs} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function DashboardNav() {
<Box flex justifyContent="space-between" gap="4" alignItems="center">
<Link href="/">
<Box flex alignItems="center" gap="2">
<Icon source={Icons.logo} size="6" />
<Icon source={Icons.logo} size={24} />
<Text variant="headingLg" as="h1">
OPub
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Icon, Text } from 'opub-ui';
export function InProgress() {
return (
<div className="flex flex-col h-full items-center justify-center gap-4">
<Icon source={Icons.construction} color="default" size="20" />
<Icon source={Icons.construction} color="default" size={80} />
<Text variant="headingSm" color="subdued">
This page is currently under construction.
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const NoList = ({
<div className="flex flex-col items-center justify-center p-6">
<Icon
source={Icons.distribution}
size="16"
size={64}
stroke={1}
color="interactive"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const FileUpload = ({
const uploadedFile = file && (
<div className="flex items-center justify-center h-full py-16">
<div className="flex gap-3 items-center py-2 px-3 rounded-05 border-borderSubdued border-1 border-solid bg-surface">
<Icon source={Icons.check} size="6" color="success" />
<Icon source={Icons.check} size={24} color="success" />

<div className="flex flex-col">
<div className="max-w-[180px]">
Expand All @@ -239,7 +239,7 @@ const FileUpload = ({
</div>
<Button
size="slim"
icon={<Icon source={Icons.delete} size="6" />}
icon={<Icon source={Icons.delete} size={24} />}
plain
accessibilityLabel="delete resource"
onClick={handleFileDelete}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Header = ({ id, title }: { id: string; title?: string }) => {
<div className="flex gap-4 flex-wrap items-center justify-between">
<div className="flex flex-wrap gap-4 items-center">
<Link href="/dashboard/dataset">
<Icon source={Icons.back} color="default" size="8" />
<Icon source={Icons.back} color="default" size={32} />
<Text visuallyHidden>Go to dataset listing page</Text>
</Link>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function ActionBar(props: Props) {
const isNavigating = useIsNavigating().isNavigating;

const { width }: Size = useWindowSize();
const iconSize = width && width < 480 ? '5' : '8';
const iconSize = width && width < 480 ? 20 : 32;

const backButton = props.previousPage && props.previousPage?.link && (
<Link href={props.previousPage?.link} className={styles.BackButton}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function Content({ data }: { data?: any }) {
source={Icons.addDataset}
color="interactive"
stroke={1}
size="20"
size={80}
/>
<Text variant="headingSm" color="subdued">
You have not added any datasets yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const RadioItem = ({
return (
<RadioCard {...props}>
<div className={styles.RadioItem}>
<Icon source={icon} size="8" />
<Icon source={icon} size={32} />
<div className={styles.RadioContent}>
<Text
variant="headingSm"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const Collapsible = ({
<span className={styles.Text}>{collapsibleHeading}</span>
<CollapsibleDemo.Trigger asChild>
<button className={styles.IconButton}>
<Icon source={iconSource} size="6" />
<Icon source={iconSource} size={24} />
</button>
</CollapsibleDemo.Trigger>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function Toolbar<TData>({
<Button
size="slim"
onClick={() => table.resetColumnFilters()}
icon={<Icon source={IconX} size="4" color="highlight" />}
icon={<Icon source={IconX} size={16} color="highlight" />}
kind="tertiary"
>
Reset
Expand Down
2 changes: 1 addition & 1 deletion packages/opub-ui/src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const Filled = () => (
<div>
<PropsVariationSection
component={Icon}
common={{ source: IconSquareRoundedChevronLeftFilled, filled: true }}
common={{ source: IconSquareRoundedChevronLeftFilled }}
xAxis={{
default: {},
}}
Expand Down
8 changes: 1 addition & 7 deletions packages/opub-ui/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { variationName } from '../../utils/css';
import { Text } from '../Text';
import styles from './Icon.module.scss';
import cx from 'classnames';
import React from 'react';

export function Icon({
source,
Expand All @@ -14,7 +13,6 @@ export function Icon({
stroke,
className,
noEvents,
filled,
}: IconProps) {
const classes = cx(
styles.Icon,
Expand All @@ -25,11 +23,7 @@ export function Icon({
);

const SourceComponent: any = source;
const iconSize = size
? typeof size === 'number'
? size
: Number(size) * 4
: 20;
const iconSize = size ? size : 20;

const style = {
height: size ? size : iconSize,
Expand Down
2 changes: 1 addition & 1 deletion packages/opub-ui/src/components/Tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const Tag = React.forwardRef(
onMouseUp={handleMouseUpByBlurring}
disabled={disabled}
>
<Icon source={IconX} size="4" />
<Icon source={IconX} />
</button>
) : null;

Expand Down
5 changes: 1 addition & 4 deletions packages/opub-ui/src/types/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SpacingSpaceScale } from '../tokens';
import { TablerIconsProps } from '@tabler/icons-react';

export type Color =
Expand Down Expand Up @@ -32,13 +31,11 @@ export interface IconProps {
/** Descriptive text to be read to screenreaders */
accessibilityLabel?: string;
/** size of the icon, use space tokens */
size?: SpacingSpaceScale | number;
size?: number;
/** stroke width */
stroke?: number;
/** class name */
className?: string;
/** Prevent click event */
noEvents?: boolean;
/** fill the icon */
filled?: boolean;
}

0 comments on commit dfe1327

Please sign in to comment.