Skip to content

Commit

Permalink
✨ feat: Add Cohere Aya (resolve #32)
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Aug 2, 2024
1 parent 8cd0289 commit c35e8fb
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/Aya/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { memo } from 'react';

import IconAvatar, { type IconAvatarProps } from '@/IconAvatar';

import { COLOR_PRIMARY, TITLE } from '../style';
import Mono from './Mono';

export type AvatarProps = Omit<IconAvatarProps, 'Icon'>;

const Avatar = memo<AvatarProps>(({ background, ...rest }) => {
return (
<IconAvatar Icon={Mono} aria-label={TITLE} background={background || COLOR_PRIMARY} {...rest} />
);
});

export default Avatar;
27 changes: 27 additions & 0 deletions src/Aya/components/Color.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { forwardRef } from 'react';

import type { IconType } from '@/types';

import { TITLE } from '../style';

const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
return (
<svg
height={size}
ref={ref}
style={{ flex: 'none', lineHeight: 1, ...style }}
viewBox="0 0 24 24"
width={size}
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path
d="M19.066.131c-.064-.106-.212-.17-.34-.106l-2.39 1.333c-1.206.678-1.968 1.397-2.434 2.772a4.677 4.677 0 00.339 3.746c.063.106.212.17.338.106l2.392-1.333c1.206-.678 1.968-1.397 2.433-2.772A4.677 4.677 0 0019.066.13zM1.926 5.421a.325.325 0 00-.318.318c0 1.714.74 3.258 1.905 4.316C4.867 11.283 6.136 11.6 7.872 11.6H11.3c.169 0 .317-.148.317-.317 0-1.714-.74-3.26-1.904-4.317C8.358 5.739 7.089 5.42 5.353 5.42H1.927zM23.826 10.542a.325.325 0 00-.317-.317v.02h-3.47c-1.757 0-3.047.34-4.423 1.567-1.185 1.036-1.946 2.623-1.946 4.359 0 .169.148.317.317.317h3.47c1.757 0 3.047-.339 4.423-1.566a5.893 5.893 0 001.947-4.38zM0 15.79c0-.233.19-.445.444-.445h4.804c2.433 0 4.21.466 6.115 2.18 1.63 1.46 2.645 3.64 2.666 6.03 0 .233-.19.445-.444.445H8.782c-2.434 0-4.211-.444-6.116-2.158C1.036 20.36.021 18.18 0 15.79z"
fill="#416FDC"
></path>
</svg>
);
});

export default Icon;
28 changes: 28 additions & 0 deletions src/Aya/components/Combine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { memo } from 'react';

import IconCombine, { type IconCombineProps } from '@/IconCombine';

import { SPACE_MULTIPLE, TEXT_MULTIPLE, TITLE } from '../style';
import Color from './Color';
import Mono from './Mono';
import Text from './Text';

export interface CombineProps extends Omit<IconCombineProps, 'Icon' | 'Text'> {
type?: 'color' | 'mono';
}
const Combine = memo<CombineProps>(({ type = 'mono', ...rest }) => {
const Icon = type === 'color' ? Color : Mono;

return (
<IconCombine
Icon={Icon}
Text={Text}
aria-label={TITLE}
spaceMultiple={SPACE_MULTIPLE}
textMultiple={TEXT_MULTIPLE}
{...rest}
/>
);
});

export default Combine;
26 changes: 26 additions & 0 deletions src/Aya/components/Mono.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { forwardRef } from 'react';

import type { IconType } from '@/types';

import { TITLE } from '../style';

const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
return (
<svg
fill="currentColor"
fillRule="evenodd"
height={size}
ref={ref}
style={{ flex: 'none', lineHeight: 1, ...style }}
viewBox="0 0 24 24"
width={size}
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path d="M19.066.131c-.064-.106-.212-.17-.34-.106l-2.39 1.333c-1.206.678-1.968 1.397-2.434 2.772a4.677 4.677 0 00.339 3.746c.063.106.212.17.338.106l2.392-1.333c1.206-.678 1.968-1.397 2.433-2.772A4.677 4.677 0 0019.066.13zM1.926 5.421a.325.325 0 00-.318.318c0 1.714.74 3.258 1.905 4.316C4.867 11.283 6.136 11.6 7.872 11.6H11.3c.169 0 .317-.148.317-.317 0-1.714-.74-3.26-1.904-4.317C8.358 5.739 7.089 5.42 5.353 5.42H1.927zM23.826 10.542a.325.325 0 00-.317-.317v.02h-3.47c-1.757 0-3.047.34-4.423 1.567-1.185 1.036-1.946 2.623-1.946 4.359 0 .169.148.317.317.317h3.47c1.757 0 3.047-.339 4.423-1.566a5.893 5.893 0 001.947-4.38zM0 15.79c0-.233.19-.445.444-.445h4.804c2.433 0 4.21.466 6.115 2.18 1.63 1.46 2.645 3.64 2.666 6.03 0 .233-.19.445-.444.445H8.782c-2.434 0-4.211-.444-6.116-2.158C1.036 20.36.021 18.18 0 15.79z"></path>
</svg>
);
});

export default Icon;
25 changes: 25 additions & 0 deletions src/Aya/components/Text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { forwardRef } from 'react';

import type { IconType } from '@/types';

import { TITLE } from '../style';

const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
return (
<svg
fill="currentColor"
fillRule="evenodd"
height={size}
ref={ref}
style={{ flex: 'none', lineHeight: 1, width: 'fit-content', ...style }}
viewBox="0 0 47 24"
xmlns="http://www.w3.org/2000/svg"
{...rest}
>
<title>{TITLE}</title>
<path d="M2 19.065c0-.06 0-.122.03-.168L7.914 2.306c.06-.2.213-.306.443-.306H10.6c.23 0 .367.107.443.306l5.898 16.607.03.152c0 .077-.03.153-.091.199a.389.389 0 01-.245.076h-1.512c-.214 0-.352-.107-.428-.305l-1.513-4.4h-7.44l-1.512 4.4c-.077.198-.214.305-.428.305H2.35c-.213 0-.32-.091-.32-.26L2 19.066zm10.511-6.31L9.441 3.88l-3.072 8.877h6.142zM21.387 23.924a.246.246 0 01-.091-.199c0-.076 0-.092.03-.168l1.559-3.988-4.95-12.497c-.03-.061-.03-.122-.03-.183 0-.184.106-.26.32-.26h1.451c.214 0 .367.107.428.306l3.88 10.068 3.897-10.068c.06-.199.213-.306.427-.306h1.375c.214 0 .321.092.321.26s0 .107-.03.183l-6.54 16.622c-.076.2-.213.306-.427.306h-1.36c-.107 0-.198-.03-.244-.076h-.015zM43.082 17.4c.122.153.351.214.657.214h.825c.122 0 .214.03.275.107a.38.38 0 01.107.275v.947c0 .122-.03.214-.107.275a.379.379 0 01-.275.107h-1.436c-.733 0-1.284-.183-1.665-.55-.367-.367-.566-.932-.581-1.68-.504.824-1.161 1.436-1.97 1.848-.795.412-1.697.626-2.69.626-.993 0-1.604-.152-2.246-.458a3.562 3.562 0 01-1.497-1.299c-.351-.55-.534-1.191-.534-1.91 0-1.038.366-1.863 1.084-2.474.718-.611 1.788-.993 3.208-1.161l4.523-.52v-.977c0-.535-.122-.994-.382-1.39-.245-.398-.611-.704-1.07-.918-.458-.213-1.008-.32-1.634-.32-.627 0-1.498.183-2.063.565-.565.367-.916.87-1.054 1.497-.046.23-.183.336-.397.336H32.86c-.122 0-.229-.03-.29-.107a.313.313 0 01-.061-.29 4.14 4.14 0 01.87-1.956c.459-.565 1.07-1.008 1.819-1.329.748-.32 1.589-.473 2.536-.473.947 0 1.91.183 2.689.534.764.352 1.36.856 1.787 1.498.413.641.627 1.39.627 2.23v6.035c0 .336.06.596.198.733l.046-.015zm-8.296-.03c.474.381 1.115.565 1.91.565.794 0 1.36-.153 1.986-.459a3.812 3.812 0 001.543-1.375c.397-.61.596-1.329.596-2.184v-.672l-4.033.458c-.932.107-1.62.32-2.063.657-.443.336-.657.81-.657 1.436 0 .626.245 1.192.718 1.573z"></path>
</svg>
);
});

export default Icon;
72 changes: 72 additions & 0 deletions src/Aya/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
nav: Components
group: Model
title: Cohere (Aya)
atomId: Aya
description: https://cohere.com/research/aya
---

## Icons

```tsx
import { Aya } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

export default () => (
<Flexbox gap={16} horizontal>
<Aya size={64} />
<Aya.Color size={64} />
</Flexbox>
);
```

## Text

```tsx
import { Aya } from '@lobehub/icons';

export default () => <Aya.Text size={48} />;
```

## Combine

```tsx
import { Aya } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

export default () => (
<Flexbox gap={16}>
<Aya.Combine size={64} />
<Aya.Combine size={64} type={'color'} />
</Flexbox>
);
```

## Avatars

```tsx
import { Aya } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

export default () => (
<Flexbox gap={16} horizontal>
<Aya.Avatar size={64} />
<Aya.Avatar size={64} shape={'square'} />
</Flexbox>
);
```

## Colors

```tsx
import { Aya } from '@lobehub/icons';
import { Flexbox } from 'react-layout-kit';

import ColorPreview from '../components/ColorPreview';

export default () => (
<Flexbox gap={16} horizontal>
<ColorPreview color={Aya.colorPrimary} />
</Flexbox>
);
```
25 changes: 25 additions & 0 deletions src/Aya/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Avatar from './components/Avatar';
import Color from './components/Color';
import Combine from './components/Combine';
import Mono from './components/Mono';
import Text from './components/Text';
import { COLOR_PRIMARY, TITLE } from './style';

export type CompoundedIcon = typeof Mono & {
Avatar: typeof Avatar;
Color: typeof Color;
Combine: typeof Combine;
Text: typeof Text;
colorPrimary: string;
title: string;
};

const Icons = Mono as CompoundedIcon;
Icons.Color = Color;
Icons.Text = Text;
Icons.Combine = Combine;
Icons.Avatar = Avatar;
Icons.colorPrimary = COLOR_PRIMARY;
Icons.title = TITLE;

export default Icons;
4 changes: 4 additions & 0 deletions src/Aya/style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const TITLE = 'Aya';
export const TEXT_MULTIPLE = 1;
export const SPACE_MULTIPLE = 0.2;
export const COLOR_PRIMARY = '#416FDC';
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export { default as AntGroup, type CompoundedIcon as AntGroupProps } from './Ant
export { default as Anthropic, type CompoundedIcon as AnthropicProps } from './Anthropic';
export { default as Automatic, type CompoundedIcon as AutomaticProps } from './Automatic';
export { default as Aws, type CompoundedIcon as AwsProps } from './Aws';
export { default as Aya, type CompoundedIcon as AyaProps } from './Aya';
export { default as Azure, type CompoundedIcon as AzureProps } from './Azure';
export { default as Baichuan, type CompoundedIcon as BaichuanProps } from './Baichuan';
export { default as Baidu, type CompoundedIcon as BaiduProps } from './Baidu';
Expand Down

0 comments on commit c35e8fb

Please sign in to comment.