diff --git a/packages/pancake-uikit/src/widgets/Menu/components/ExternalLink.tsx b/packages/pancake-uikit/src/widgets/Menu/components/ExternalLink.tsx new file mode 100644 index 0000000..5407716 --- /dev/null +++ b/packages/pancake-uikit/src/widgets/Menu/components/ExternalLink.tsx @@ -0,0 +1,31 @@ +import React from "react"; +import styled from "styled-components"; +import Flex from "../../../components/Box/Flex"; +import Text from "../../../components/Text/Text"; +import Dropdown from "../../../components/Dropdown/Dropdown"; +import Link from "../../../components/Link/Link"; +import MoreIcon from "../../../components/Svg/Icons/More"; +interface ExternalLinkProps { + link?: string; + name?: string; + icon?: string; +} + +const Image = styled.img` + width: 30px; + height: 30px; + border-radius: 50%; + cursor: pointer; +`; + +const ExternalLink: React.FC = ({ link = "", name = "", icon = "" }) => { + return ( + <> + + {icon ? : {name}} + + + ); +}; + +export default ExternalLink; diff --git a/packages/pancake-uikit/src/widgets/Menu/components/PanelFooter.tsx b/packages/pancake-uikit/src/widgets/Menu/components/PanelFooter.tsx index 30bca74..d43c0d9 100644 --- a/packages/pancake-uikit/src/widgets/Menu/components/PanelFooter.tsx +++ b/packages/pancake-uikit/src/widgets/Menu/components/PanelFooter.tsx @@ -14,6 +14,7 @@ import Dropdown from "../../../components/Dropdown/Dropdown"; import Link from "../../../components/Link/Link"; import MoreIcon from "../../../components/Svg/Icons/More"; import ChevronRightIcon from "../../../components/Svg/Icons/ChevronRight"; +import ExternalLink from "./ExternalLink"; interface Props extends PanelProps, PushedProps {} @@ -58,7 +59,7 @@ const ImageDiv = styled.div` /* padding: 0 10px; */ border-radius: 10px; position: absolute; - width: 100px; + width: 140px; /* height: 400px; */ /* top: 0; */ right: 0px; @@ -86,7 +87,7 @@ const ImageItem = styled.div` position: absolute; width: 100px; right: 0px; - left: 80px; + left: 130px; z-index: 99999; bottom: 0; margin: 20px auto; @@ -116,6 +117,12 @@ const MoreIconSvg = styled(MoreIcon)` width: 30px; height: 30px; `; +const TextDiv = styled(Text)` + width: 70px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +`; const PanelFooter: React.FC = ({ isPushed, @@ -128,16 +135,17 @@ const PanelFooter: React.FC = ({ setLang, socialLink, }) => { - let defaultList: SocialLink[] | undefined; - let moreList: SocialLink[] | undefined; - if (socialLink && socialLink.length > 2) { - const list = JSON.parse(JSON.stringify(socialLink)); - const listLink = JSON.parse(JSON.stringify(socialLink)); - moreList = list.slice(2, socialLink.length); - defaultList = listLink.splice(0, 2); - } else { - defaultList = socialLink; + let defaultList = undefined; + let moreList = undefined; + if (socialLink && socialLink.length > 0) { + defaultList = socialLink.filter((item, index) => { + if (index < 2) return item; + }); + moreList = socialLink.filter((item, index) => { + if (index >= 2) return item; + }); } + if (!isPushed) { return ( @@ -151,32 +159,21 @@ const PanelFooter: React.FC = ({ - <> - {defaultList && defaultList.length > 0 - ? defaultList.map((item) => { - return item.list && item.list.length > 1 ? ( - }> - {item.list && item.list.length > 0 - ? item.list?.map((childItem) => { - return ( - - {childItem.name} - - ); - }) - : ""} - - ) : item.list && item.list.length > 0 ? ( - - - - ) : ( - "" - ); - }) - : ""} - {moreList && moreList.length > 0 ? ( + {defaultList?.map((item) => { + return item.list && item.list.length > 1 ? ( + }> + {item.list?.map((childItem) => { + return ; + })} + + ) : item.list ? ( + + ) : ( + "" + ); + })} + {moreList ? (
@@ -188,17 +185,13 @@ const PanelFooter: React.FC = ({ <> - {item.name} + {item.name}
{item.list?.map((childItem) => { - return ( - - {childItem.name} - - ); + return ; })}