Skip to content

Commit

Permalink
(feat) O3-4161: Add a Report icon to the CarbonMRS icon pack (#1194)
Browse files Browse the repository at this point in the history
* O3-4161 Adding the Report Icon to the CarbonMRS Framework

* Update API.md
  • Loading branch information
Munyua123 authored Nov 4, 2024
1 parent c1b817c commit 533e15d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/framework/esm-framework/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/icons/icons.tsx:622](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L622)
[packages/framework/esm-styleguide/src/icons/icons.tsx:630](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L630)

___

Expand Down Expand Up @@ -1233,7 +1233,7 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/icons/icons.tsx:627](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L627)
[packages/framework/esm-styleguide/src/icons/icons.tsx:635](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L635)

___

Expand Down Expand Up @@ -1427,7 +1427,7 @@ Note this is an alias for ListCheckedIcon

#### Defined in

[packages/framework/esm-styleguide/src/icons/icons.tsx:634](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L634)
[packages/framework/esm-styleguide/src/icons/icons.tsx:642](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L642)

___

Expand Down Expand Up @@ -1839,6 +1839,16 @@ ___

___

### ReportIcon

`Const` **ReportIcon**: `MemoExoticComponent`<`ForwardRefExoticComponent`<[`IconProps`](API.md#iconprops) & `RefAttributes`<`SVGSVGElement`\>\>\>

#### Defined in

[packages/framework/esm-styleguide/src/icons/icons.tsx:619](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L619)

___

### ResetIcon

`Const` **ResetIcon**: `MemoExoticComponent`<`ForwardRefExoticComponent`<[`IconProps`](API.md#iconprops) & `RefAttributes`<`SVGSVGElement`\>\>\>
Expand Down Expand Up @@ -1889,7 +1899,7 @@ Note this is an alias for ShoppingCartArrowDownIcon

#### Defined in

[packages/framework/esm-styleguide/src/icons/icons.tsx:646](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L646)
[packages/framework/esm-styleguide/src/icons/icons.tsx:654](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/icons/icons.tsx#L654)

___

Expand Down
1 change: 1 addition & 0 deletions packages/framework/esm-styleguide/mock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const PedestrianFamilyIcon = () => <div>PedestrianFamilyIcon</div>;
export const PenIcon = () => <div>PenIcon</div>;
export const PrinterIcon = () => <div>PrinterIcon</div>;
export const RenewIcon = () => <div>RenewIcon</div>;
export const ReportIcon = () => <div>ReportIcon</div>;
export const ResetIcon = () => <div>ResetIcon</div>;
export const PasswordIcon = () => <div>PasswordIcon</div>;
export const SaveIcon = () => <div>SaveIcon</div>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import pen from './svgs/pen.svg';
import printer from './svgs/printer.svg';
import renew from './svgs/renew.svg';
import password from './svgs/password.svg';
import report from './svgs/report.svg';
import reset from './svgs/reset.svg';
import save from './svgs/save.svg';
import search from './svgs/search.svg';
Expand Down Expand Up @@ -131,6 +132,7 @@ export function setupIcons() {
addSvg('omrs-icon-printer', printer);
addSvg('omrs-icon-renew', renew);
addSvg('omrs-icon-password', password);
addSvg('omrs-icon-report', report);
addSvg('omrs-icon-reset', reset);
addSvg('omrs-icon-search', search);
addSvg('omrs-icon-save', save);
Expand Down
8 changes: 8 additions & 0 deletions packages/framework/esm-styleguide/src/icons/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,14 @@ export const WarningIcon = memo(
}),
);

/**
*/
export const ReportIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ReportIcon(props, ref) {
return <Icon ref={ref} icon="omrs-icon-report" iconProps={props} />;
}),
);

// Icon aliases that are a little more aligned to specific use-cases
// should all resolve to a defined React icon

Expand Down

1 comment on commit 533e15d

@Naliceeeeeee
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have managed to come up with this. **
/
@category Icons */
import React, { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';
import classNames, { type Argument } from 'classnames';
import style from './icons.module.scss';

export type IconProps = {
className?: Argument;
fill?: string;
size?: number;
};

/**
*/
export const ActivityIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ActivityIcon(props, ref) {
return ;
}),
);

/**
*/
export const AddIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function AddIcon(props, ref) {
return ;
}),
);

/**
*/
export const ArrowDownIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ArrowDownIcon(props, ref) {
return ;
}),
);

/**
*/
export const ArrowLeftIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ArrowLeftIcon(props, ref) {
return ;
}),
);

/**
*/
export const ArrowRightIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ArrowRightIcon(props, ref) {
return ;
}),
);

/**
*/
export const ArrowUpIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ArrowUpIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const BabyIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function BabyIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CalendarHeatMapIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CalendarHeatMap(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CalendarIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function Calendar(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CaretDownIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CaretDownIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CaretLeftIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CaretLeftIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CaretRightIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CaretRightIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CaretUpIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CaretUpIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const CheckmarkFilledIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CheckmarkFilledIcon(props, ref) {
return ;
}),
);

/**
*/
export const CheckmarkOutlineIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CheckmarkOutlineIcon(props, ref) {
return ;
}),
);

/**
*/
export const ChartAverageIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ChartAverageIcon(props, ref) {
return ;
}),
);

/**
*/
export const ChemistryIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ChemistryIcon(props, ref) {
return ;
}),
);

/**
*/
export const ChevronDownIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ChevronDownIcon(props, ref) {
return ;
}),
);

/**
*/
export const ChevronLeftIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ChevronLeftIcon(props, ref) {
return ;
}),
);

/**
*/
export const ChevronRightIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ChevronRightIcon(props, ref) {
return ;
}),
);

/**
*/
export const ChevronUpIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ChevronUpIcon(props, ref) {
return ;
}),
);

/**
*/
export const CloseFilledIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CloseFilledIcon(props, ref) {
return ;
}),
);

/**
*/
export const CloseOutlineIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CloseOutlineIcon(props, ref) {
return ;
}),
);

/**
*/
export const CloseIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function CloseIcon(props, ref) {
return ;
}),
);

/**
*/
export const DocumentAttachmentIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function DocumentAttachmentIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const DocumentIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function DocumentIcon(props: IconProps, ref) {
return ;
}),
);

/**
*/
export const DownloadIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function DownloadIcon(props, ref) {
return ;
}),
);

/**
*/
export const EditIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function EditIcon(props, ref) {
return ;
}),
);

/**
*/
export const EventScheduleIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function EventScheduleIcon(props, ref) {
return ;
}),
);

/**
*/
export const EventsIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function EventsIcon(props, ref) {
return ;
}),
);

/**
*/
export const GroupIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function GroupIcon(props, ref) {
return ;
}),
);

/**
*/
export const GroupAccessIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function GroupAccessIcon(props, ref) {
return ;
}),
);

/**
*/
export const HospitalBedIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function HospitalBedIcon(props, ref) {
return ;
}),
);

/**
*/
export const ImageMedicalIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ImageMedicalIcon(props, ref) {
return ;
}),
);

/**
*/
export const InventoryManagementIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function InventoryManagementIcon(props, ref) {
return ;
}),
);

/**
*/
export const InformationIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function InformationIcon(props, ref) {
return ;
}),
);

/**
*/
export const InformationFilledIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function InformationFilledIcon(props, ref) {
return ;
}),
);

/**
*/
export const InformationSquareIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function InformationSquareIcon(props, ref) {
return ;
}),
);

/**
*/
export const ListCheckedIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ListCheckedIcon(props, ref) {
return ;
}),
);

/**
*/
export const LocationIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function LocationIcon(props, ref) {
return ;
}),
);

/**
*/
export const MaximizeIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function MaximizeIcon(props, ref) {
return ;
}),
);

/**
*/
export const MedicationIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function MedicationIcon(props, ref) {
return ;
}),
);

/**
*/
export const MessageQueueIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function MessageQueueIcon(props, ref) {
return ;
}),
);

/**
*/
export const MicroscopeIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function MicroscopeIcon(props, ref) {
return ;
}),
);

/**

  • Billing
    */
    export const MoneyIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function MoneyIcon(props, ref) {
    return ;
    }),
    );

/**
*/
export const MotherIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function MotherIcon(props, ref) {
return ;
}),
);

/**
*/
export const MovementIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function MovementIcon(props, ref) {
return ;
}),
);

/**
*/
export const OverflowMenuHorizontalIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function OverflowMenuHorizontalIcon(props, ref) {
return ;
}),
);

/**
*/
export const OverflowMenuVerticalIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function OverflowMenuVerticalIcon(props, ref) {
return ;
}),
);

/**
*/
export const PedestrianFamilyIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function PedestrianFamilyIcon(props, ref) {
return ;
}),
);

/**
*/
export const PenIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function PenIcon(props, ref) {
return ;
}),
);

/**
*/
export const PrinterIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function PrinterIcon(props, ref) {
return ;
}),
);

/**
*/
export const RenewIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function RenewIcon(props, ref) {
return ;
}),
);

/**
*/
export const ResetIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ResetIcon(props, ref) {
return ;
}),
);

/**
*/
export const TranslateIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function TranslateIcon(props, ref) {
return ;
}),
);

/**
*/
export const SaveIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function SaveIcon(props, ref) {
return ;
}),
);

/**
*/
export const SearchIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function SearchIcon(props, ref) {
return ;
}),
);

/**
*/
export const SwitcherIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function SwitcherIcon(props, ref) {
return ;
}),
);

/**

  • Order Basket, the UI to enter Orders for Medications, Referrals, Labs, Procedures and more
    */
    export const ShoppingCartIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function ShoppingCartIcon(props, ref) {
    return ;
    }),
    );

/**

  • Used as a button to add an item to the Order basket from a search
    */
    export const ShoppingCartArrowDownIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function ShoppingCartArrowDownIcon(props, ref) {
    return ;
    }),
    );

/**

  • Used as action button to open ward in-patient note workspace
    */
    export const StickyNoteAddIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function StickyNoteAddIcon(props, ref) {
    return ;
    }),
    );

/**

  • Used as a button to add an item to the Order basket from a search
    */
    export const TableOfContentsIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function TableOfContentsIcon(props, ref) {
    return ;
    }),
    );

/**
*/
export const TableIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function TableIcon(props, ref) {
return ;
}),
);

/**

  • Lab investigations
    */
    export const TimeIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function TimeIcon(props, ref) {
    return ;
    }),
    );

/**
*/
export const ToolsIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ToolsIcon(props, ref) {
return ;
}),
);

/**
*/
export const TrashCanIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function TrashCanIcon(props, ref) {
return ;
}),
);

/**
*/
export const TreeViewAltIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function TreeViewAltIcon(props, ref) {
return ;
}),
);

/**

  • User of OpenMRS e.g. My Account
    */
    export const UserAvatarIcon = memo(
    forwardRef<SVGSVGElement, IconProps>(function UserAvatarIcon(props, ref) {
    return ;
    }),
    );

/**
*/
export const UserFollowIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function UserFollowIcon(props, ref) {
return ;
}),
);

/**
*/
export const UserXrayIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function UserXrayIcon(props, ref) {
return ;
}),
);

export const PasswordIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function PasswordIcon(props, ref) {
return ;
}),
);

/**
*/
export const UserIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function UserIcon(props, ref) {
return ;
}),
);

/**
*/
export const ViewOffIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ViewOffIcon(props, ref) {
return ;
}),
);

/**
*/
export const ViewIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ViewIcon(props, ref) {
return ;
}),
);

/**
*/
export const WarningIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function WarningIcon(props, ref) {
return ;
}),
);

/**
*/
export const ReportIcon = memo(
forwardRef<SVGSVGElement, IconProps>(function ReportIcon(props, ref) {
return ;
}),
);

// Icon aliases that are a little more aligned to specific use-cases
// should all resolve to a defined React icon

/**
*/
export const AllergiesIcon = WarningIcon;

/**
*
*/
export const AttachmentIcon = DocumentAttachmentIcon;

/**

  • Conditions
  • Note this is an alias for ListCheckedIcon
    */
    export const ConditionsIcon = ListCheckedIcon;

/**
*
*/
export const RadiologyIcon = ImageMedicalIcon;

/**

  • Used as a button to add an item to the Order basket from a search
  • Note this is an alias for ShoppingCartArrowDownIcon
    */
    export const ShoppingCartAddItemIcon = ShoppingCartArrowDownIcon;

export type SvgIconProps = {
icon: string;
iconProps: IconProps;
};

/**

  • This is a utility type for custom icons that use the svg-sprite-loader to bundle custom icons
    */
    export const Icon = memo(
    forwardRef<SVGSVGElement, SvgIconProps>(function Icon({ icon, iconProps }, ref) {
    let { className, fill, size } = Object.assign({}, { fill: 'currentColor', size: 20 }, iconProps);
    if (size <= 0 || size > 72) {
    console.error(Invalid size '${size}' specified for ${icon}. Defaulting to 20.);
    size = 20;
    }
    const iconRef = useRef(null);

    useImperativeHandle(ref, () => iconRef.current!);

    useEffect(() => {
    if (iconRef.current) {
    if (fill !== 'currentColor') {
    iconRef.current.style.setProperty('--omrs-icon-fill', fill);
    }
    }
    }, []);

    return (
    <svg
    ref={iconRef}
    className={classNames('omrs-icon', style.icon, className)}
    height={size}
    width={size}
    viewBox="0 0 16 16"

     <use href={`#${icon}`} />
    
    );

}),
);

Please sign in to comment.