diff --git a/website/build-app/components/IconsList/index.tsx b/website/build-app/components/IconsList/index.tsx index 9c7cc97a1..88b5fe75b 100644 --- a/website/build-app/components/IconsList/index.tsx +++ b/website/build-app/components/IconsList/index.tsx @@ -6,6 +6,8 @@ import { Box } from '@welcome-ui/box' import { camelCase, startCase } from 'lodash' import { Text } from '@welcome-ui/text' import { Card } from '@welcome-ui/card' +import { Toast, toast } from '@welcome-ui/toast' +import styled from '@xstyled/styled-components' import { actions, @@ -36,6 +38,43 @@ export type IconListProps = { | 'brands' | 'flags' } + +const handleClickToCopy = (componentName: string) => { + const component = `<${componentName} />` + navigator.clipboard.writeText(component) + + toast( + +

+ {component} copied to your clipboard +

+
, + { position: 'bottom-center' } + ) +} + +const StyledCard = styled(Card)` + display: flex; + flex-direction: column; + align-items: center; + padding: xl; + color: dark-900; + border-radius: xl; + cursor: pointer; + + &, + & span { + transition: medium; + } + + &:hover { + border-color: dark-900; + span { + color: dark-900; + } + } +` + export const IconsList = ({ isIconFont, name }: IconListProps) => { const iconsByName = { arrows: arrows, @@ -66,15 +105,7 @@ export const IconsList = ({ isIconFont, name }: IconListProps) => { } return ( - + handleClickToCopy(componentName)}> {Icon ? : } { > {componentName} - + ) })}