diff --git a/src/components/Buttons/DropdownButton/OptionPanel.js b/src/components/Buttons/DropdownButton/OptionPanel.js index 89d8c8ce3..d51679dec 100644 --- a/src/components/Buttons/DropdownButton/OptionPanel.js +++ b/src/components/Buttons/DropdownButton/OptionPanel.js @@ -2,7 +2,7 @@ import React from 'react' import T from 'prop-types' import { ICON } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, @@ -56,7 +56,7 @@ const OptionPanel = ({ options, onClick, panelMinWidth }) => { {item.title} {item.link && } - {cutFrom(item.desc, 26)} + {cutRest(item.desc, 26)} ))} diff --git a/src/components/Buttons/styles/dropdown_button/option_panel.ts b/src/components/Buttons/styles/dropdown_button/option_panel.ts index 4dface858..96c89786b 100644 --- a/src/components/Buttons/styles/dropdown_button/option_panel.ts +++ b/src/components/Buttons/styles/dropdown_button/option_panel.ts @@ -58,7 +58,7 @@ export const Header = styled.div` color: ${theme('thread.articleTitle')}; ` export const Title = styled.div` - ${css.cutFrom('90%')}; + ${css.cutRest('90%')}; font-size: 14px; ` export const LinkIcon = styled(Img)` diff --git a/src/components/CollapseMenu/styles/group.ts b/src/components/CollapseMenu/styles/group.ts index d7c5c53b4..81c294704 100644 --- a/src/components/CollapseMenu/styles/group.ts +++ b/src/components/CollapseMenu/styles/group.ts @@ -32,7 +32,7 @@ export const Title = styled.div` margin-left: 4px; font-size: 14px; margin-right: 8px; - ${css.cutFrom('85px')}; + ${css.cutRest('85px')}; ${Header}:hover & { opacity: 0.65; diff --git a/src/components/CollapseMenu/styles/index.ts b/src/components/CollapseMenu/styles/index.ts index d7c5c53b4..81c294704 100755 --- a/src/components/CollapseMenu/styles/index.ts +++ b/src/components/CollapseMenu/styles/index.ts @@ -32,7 +32,7 @@ export const Title = styled.div` margin-left: 4px; font-size: 14px; margin-right: 8px; - ${css.cutFrom('85px')}; + ${css.cutRest('85px')}; ${Header}:hover & { opacity: 0.65; diff --git a/src/components/CollapseMenu/styles/item.ts b/src/components/CollapseMenu/styles/item.ts index 1bbf4b34b..35dc0cf4e 100644 --- a/src/components/CollapseMenu/styles/item.ts +++ b/src/components/CollapseMenu/styles/item.ts @@ -15,7 +15,7 @@ export const Wrapper = styled.div` ` export const Title = styled.div` color: ${theme('tags.text')}; - ${css.cutFrom('200px')}; + ${css.cutRest('200px')}; font-size: 14px; opacity: 0.9; font-weight: ${({ active }) => (active ? 'bold' : 'normal')}; diff --git a/src/components/ContentBanner/styles/index.ts b/src/components/ContentBanner/styles/index.ts index 9d193b88b..7c37a2c29 100755 --- a/src/components/ContentBanner/styles/index.ts +++ b/src/components/ContentBanner/styles/index.ts @@ -36,7 +36,7 @@ export const Title = styled.div` font-size: 1.5em; color: ${theme('thread.articleTitle')}; - ${css.cutFrom('100%')}; + ${css.cutRest('100%')}; ` export const Desc = styled.div` ${css.flex('align-center')}; diff --git a/src/components/DiscussLinker/styles/index.ts b/src/components/DiscussLinker/styles/index.ts index 1d18669a3..438eed1e4 100755 --- a/src/components/DiscussLinker/styles/index.ts +++ b/src/components/DiscussLinker/styles/index.ts @@ -55,7 +55,7 @@ export const GithubIcon = styled(Img)` export const IssueLink = styled.a` color: ${theme('banner.title')}; - ${css.cutFrom('230px')}; + ${css.cutRest('230px')}; transition: color 0.2s; &:hover { diff --git a/src/components/FeedsBar/styles/source_selector.ts b/src/components/FeedsBar/styles/source_selector.ts index ff023722b..583e46379 100755 --- a/src/components/FeedsBar/styles/source_selector.ts +++ b/src/components/FeedsBar/styles/source_selector.ts @@ -30,7 +30,7 @@ export const Icon = styled(Img)` ${css.circle(34)}; ` export const Title = styled.div` - ${css.cutFrom('60px')}; + ${css.cutRest('60px')}; text-align: center; padding-left: 5px; color: ${theme('thread.articleDigest')}; diff --git a/src/components/GalleryHub/PeopleGallery/DeveloperGallery.js b/src/components/GalleryHub/PeopleGallery/DeveloperGallery.js index 95eb0c637..4da81e665 100644 --- a/src/components/GalleryHub/PeopleGallery/DeveloperGallery.js +++ b/src/components/GalleryHub/PeopleGallery/DeveloperGallery.js @@ -8,7 +8,7 @@ import React from 'react' import T from 'prop-types' import { ICON, ASSETS_ENDPOINT } from '@/config' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import IconText from '@/components/IconText' import CardHeader from './CardHeader' @@ -83,8 +83,8 @@ const DeveloperGallery = ({ items }) => { - {cutFrom(item.title, 18)} - {cutFrom(item.desc, 35)} + {cutRest(item.title, 18)} + {cutRest(item.desc, 35)} social list diff --git a/src/components/GalleryHub/PeopleGallery/FamePeopleGallery.js b/src/components/GalleryHub/PeopleGallery/FamePeopleGallery.js index e3d46f263..db9eeca83 100755 --- a/src/components/GalleryHub/PeopleGallery/FamePeopleGallery.js +++ b/src/components/GalleryHub/PeopleGallery/FamePeopleGallery.js @@ -8,7 +8,7 @@ import React from 'react' import T from 'prop-types' import { ICON } from '@/config' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import IconText from '@/components/IconText' import CardHeader from './CardHeader' @@ -85,7 +85,7 @@ const FamePeopleList = ({ items }) => { - {cutFrom(item.desc, 50)} + {cutRest(item.desc, 50)}
22 diff --git a/src/components/GalleryHub/ProductGallery.js b/src/components/GalleryHub/ProductGallery.js index bb2824b7a..d5d9ae995 100755 --- a/src/components/GalleryHub/ProductGallery.js +++ b/src/components/GalleryHub/ProductGallery.js @@ -9,7 +9,7 @@ import T from 'prop-types' import { isEmpty } from 'ramda' import { ICON } from '@/config' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import { ArrowButton } from '@/components/Buttons' @@ -142,7 +142,7 @@ const ProductGallery = ({ items }) => { - {item.desc && {cutFrom(item.desc, 50)}} + {item.desc && {cutRest(item.desc, 50)}} {!item.desc && !isEmpty(item.tags) && ( )} diff --git a/src/components/GalleryHub/SponsorGallery.js b/src/components/GalleryHub/SponsorGallery.js index 505b3c7a3..e6cdcc478 100755 --- a/src/components/GalleryHub/SponsorGallery.js +++ b/src/components/GalleryHub/SponsorGallery.js @@ -8,7 +8,7 @@ import React from 'react' import T from 'prop-types' import { ASSETS_ENDPOINT } from '@/config' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import { ArrowButton } from '@/components/Buttons' @@ -137,7 +137,7 @@ const SponsorGallery = ({ items, column }) => { )} {item.desc && ( - {cutFrom(item.desc, 30)} + {cutRest(item.desc, 30)} )} {item.addr} diff --git a/src/components/GalleryHub/styles/people_gallery/fame_people_gallery.ts b/src/components/GalleryHub/styles/people_gallery/fame_people_gallery.ts index a9a193a52..2ecb19ab4 100755 --- a/src/components/GalleryHub/styles/people_gallery/fame_people_gallery.ts +++ b/src/components/GalleryHub/styles/people_gallery/fame_people_gallery.ts @@ -32,7 +32,7 @@ export const Title = styled.div` color: ${theme('thread.articleTitle')}; font-size: 18px; cursor: pointer; - ${css.cutFrom('200px')}; + ${css.cutRest('200px')}; ` export const AKA = styled.div` color: ${theme('thread.articleDigest')}; diff --git a/src/components/GithubRepoPage/Header.js b/src/components/GithubRepoPage/Header.js index b0412a407..ea9349f42 100755 --- a/src/components/GithubRepoPage/Header.js +++ b/src/components/GithubRepoPage/Header.js @@ -2,7 +2,7 @@ import React from 'react' import { ICON_CMD } from '@/config' -import { numberWithCommas, cutFrom } from '@/utils' +import { numberWithCommas, cutRest } from '@/utils' import Tooltip from '@/components/Tooltip' import { @@ -33,7 +33,7 @@ const TitlesInfo = ({ repo }) => ( / - {cutFrom(repo.title, 20)} + {cutRest(repo.title, 20)} {' '} ) diff --git a/src/components/JobItem/CompanyInfo.js b/src/components/JobItem/CompanyInfo.js index 5c9e3a925..175439d1d 100755 --- a/src/components/JobItem/CompanyInfo.js +++ b/src/components/JobItem/CompanyInfo.js @@ -1,7 +1,7 @@ import React from 'react' import { isEmpty } from 'ramda' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, TopHalf, @@ -24,7 +24,7 @@ const CompanyInfo = ({
- {cutFrom(company, 12)} + {cutRest(company, 12)}
diff --git a/src/components/JobItem/JobInfo.js b/src/components/JobItem/JobInfo.js index e8eff71bc..9ae92e9c9 100755 --- a/src/components/JobItem/JobInfo.js +++ b/src/components/JobItem/JobInfo.js @@ -2,7 +2,7 @@ import React from 'react' import TimeAgo from 'timeago-react' import { HCN } from '@/constant' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import InlineCommunities from '@/components/InlineCommunities' import InlineTags from '@/components/InlineTags' import DotDivider from '@/components/DotDivider' @@ -44,7 +44,7 @@ const JobInfo = ({ }) => (
- {cutFrom(title, 30)} + {cutRest(title, 30)} diff --git a/src/components/JobItem/ListView.js b/src/components/JobItem/ListView.js index 8d922034d..235f1816b 100755 --- a/src/components/JobItem/ListView.js +++ b/src/components/JobItem/ListView.js @@ -2,7 +2,7 @@ import React from 'react' import TimeAgo from 'timeago-react' import { ICON_CMD } from '@/config' -import { cutFrom, parseDomain } from '@/utils' +import { cutRest, parseDomain } from '@/utils' import InlineTags from '@/components/InlineTags' import DotDivider from '@/components/DotDivider' @@ -32,7 +32,7 @@ const ListView = ({ entry, onPreview }) => ( onPreview(entry)}> - 【 {entry.company} 】{cutFrom(entry.title, 45)} + 【 {entry.company} 】{cutRest(entry.title, 45)} {entry.linkAddr && ( diff --git a/src/components/JobItem/styles/company_info.ts b/src/components/JobItem/styles/company_info.ts index 6eaa6f668..124082285 100755 --- a/src/components/JobItem/styles/company_info.ts +++ b/src/components/JobItem/styles/company_info.ts @@ -37,14 +37,14 @@ export const Footer = styled.div` font-size: 0.8rem; color: ${theme('thread.articleDigest')}; ${css.media.mobile` - ${css.cutFrom('100px')}; + ${css.cutRest('100px')}; `}; ` export const Title = styled.div` color: ${theme('thread.articleTitle')}; font-size: 0.9rem; ${css.media.mobile` - ${css.cutFrom('90px')}; + ${css.cutRest('90px')}; `}; ` export const StatesWrapper = styled.div` diff --git a/src/components/JobItem/styles/job_info.ts b/src/components/JobItem/styles/job_info.ts index 88a02da22..a697c2ecc 100755 --- a/src/components/JobItem/styles/job_info.ts +++ b/src/components/JobItem/styles/job_info.ts @@ -29,7 +29,7 @@ export const Title = styled.div` color: ${theme('thread.articleTitle')}; font-size: 1rem; ${css.media.mobile` - ${css.cutFrom('150px')}; + ${css.cutRest('150px')}; `}; ` export const CommunitiesWrapper = styled.div` diff --git a/src/components/LinksCard/styles/item.ts b/src/components/LinksCard/styles/item.ts index 1069b7cf7..131c2d4e3 100644 --- a/src/components/LinksCard/styles/item.ts +++ b/src/components/LinksCard/styles/item.ts @@ -9,7 +9,7 @@ export const Wrapper = styled.div` ` export const Title = styled.div` /* ${css.flex('align-center')}; */ - ${css.cutFrom('200px')}; + ${css.cutRest('200px')}; color: ${theme('banner.desc')}; ${Wrapper}:hover & { diff --git a/src/components/LoadingEffects/styles/community_holder.ts b/src/components/LoadingEffects/styles/community_holder.ts index 5524a0ff8..46ae4327f 100755 --- a/src/components/LoadingEffects/styles/community_holder.ts +++ b/src/components/LoadingEffects/styles/community_holder.ts @@ -30,6 +30,6 @@ export const CommunitiesText = styled.div` margin-bottom: 8px; ` export const BannerText = styled.div` - ${css.cutFrom('45px')}; + ${css.cutRest('45px')}; text-align: center; ` diff --git a/src/components/Navigator/styles/brief_view.ts b/src/components/Navigator/styles/brief_view.ts index 40ac39099..ab7d0982a 100755 --- a/src/components/Navigator/styles/brief_view.ts +++ b/src/components/Navigator/styles/brief_view.ts @@ -49,7 +49,7 @@ export const CommunityTitle = styled.div` font-weight: bold; margin-top: -2px; - ${css.cutFrom('90px')}; + ${css.cutRest('90px')}; ` export const Breadcrumbs = styled.div` ${css.flex('align-center')}; diff --git a/src/components/Navigator/styles/more_panel/mobile_view.ts b/src/components/Navigator/styles/more_panel/mobile_view.ts index cc66727bd..5d81415ca 100644 --- a/src/components/Navigator/styles/more_panel/mobile_view.ts +++ b/src/components/Navigator/styles/more_panel/mobile_view.ts @@ -51,7 +51,7 @@ export const Title = styled.div` ` export const Desc = styled.div` color: ${theme('thread.articleDigest')}; - ${css.cutFrom('100px')}; + ${css.cutRest('100px')}; font-size: 11px; margin-top: 2px; ` diff --git a/src/components/PostItem/DigestView/DesktopView/Body.js b/src/components/PostItem/DigestView/DesktopView/Body.js index e0e95de4f..725e3ce7b 100644 --- a/src/components/PostItem/DigestView/DesktopView/Body.js +++ b/src/components/PostItem/DigestView/DesktopView/Body.js @@ -2,7 +2,7 @@ import React from 'react' import TimeAgo from 'timeago-react' import { ICON } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import Tooltip from '@/components/Tooltip' import { SpaceGrow } from '@/components/Common' @@ -48,7 +48,7 @@ const Body = ({ item, onPreview }) => { onPreview(item)}> - {cutFrom(item.digest, 90)} + {cutRest(item.digest, 90)} ) diff --git a/src/components/PostItem/DigestView/MobileView/Footer.js b/src/components/PostItem/DigestView/MobileView/Footer.js index aaf48135a..182632d70 100644 --- a/src/components/PostItem/DigestView/MobileView/Footer.js +++ b/src/components/PostItem/DigestView/MobileView/Footer.js @@ -1,6 +1,6 @@ import React from 'react' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { ICON_CMD } from '@/config' import DotDivider from '@/components/DotDivider' @@ -28,7 +28,7 @@ const Footer = ({ item }) => { {item.commentsCount} - {cutFrom(item.digest, 20)} + {cutRest(item.digest, 20)} ) } diff --git a/src/components/PostItem/ListView.js b/src/components/PostItem/ListView.js index 307ec51eb..2d49124ca 100755 --- a/src/components/PostItem/ListView.js +++ b/src/components/PostItem/ListView.js @@ -3,7 +3,7 @@ import TimeAgo from 'timeago-react' import { ICON_CMD } from '@/config' -import { cutFrom, parseDomain } from '@/utils' +import { cutRest, parseDomain } from '@/utils' import InlineTags from '@/components/InlineTags' import { @@ -27,7 +27,7 @@ const ListView = ({ entry, onPreview }) => (
onPreview(entry)}> - {cutFrom(entry.title, 45)} + {cutRest(entry.title, 45)} {entry.linkAddr && ( diff --git a/src/components/PostItem/styles/list_view.ts b/src/components/PostItem/styles/list_view.ts index 79e83181f..d5d67858f 100644 --- a/src/components/PostItem/styles/list_view.ts +++ b/src/components/PostItem/styles/list_view.ts @@ -92,7 +92,7 @@ export const BodyDigest = styled.li` max-width: 85%; ${css.media.mobile` - ${css.cutFrom('250px')}; + ${css.cutRest('250px')}; `}; ` export const CommentWrapper = styled.div` diff --git a/src/components/RepoItem/Header.js b/src/components/RepoItem/Header.js index 2cc1276c1..ba4c7d050 100755 --- a/src/components/RepoItem/Header.js +++ b/src/components/RepoItem/Header.js @@ -2,7 +2,7 @@ import React from 'react' import { ICON_CMD } from '@/config' -import { cutFrom, numberWithCommas } from '@/utils' +import { cutRest, numberWithCommas } from '@/utils' import Tooltip from '@/components/Tooltip' import { Space } from '@/components/Common' import InlineTags from '@/components/InlineTags' @@ -34,7 +34,7 @@ const Header = ({ entry, onPreview }) => { {entry.ownerName} - / {cutFrom(entry.title, 20)} + / {cutRest(entry.title, 20)} diff --git a/src/components/RepoItem/index.js b/src/components/RepoItem/index.js index f3daec258..c618ed9bb 100755 --- a/src/components/RepoItem/index.js +++ b/src/components/RepoItem/index.js @@ -7,7 +7,7 @@ import React from 'react' import T from 'prop-types' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import { C11N } from '@/constant' import ArticleItemPrefixLabel from '@/components/ArticleItemPrefixLabel' @@ -28,7 +28,7 @@ const RepoItem = ({ entry, active, onPreview, accountInfo }) => ( topOffset="22px" />
onPreview(entry)} /> - {cutFrom(entry.desc, 180)} + {cutRest(entry.desc, 180)}
{ return ( - {cutFrom(title, 40)} + {cutRest(title, 40)} {desc}
diff --git a/src/components/VideoItem/index.js b/src/components/VideoItem/index.js index 546d4cc0b..20dc6f40a 100755 --- a/src/components/VideoItem/index.js +++ b/src/components/VideoItem/index.js @@ -10,7 +10,7 @@ import TimeAgo from 'timeago-react' import { ICON_CMD } from '@/config' import { C11N } from '@/constant' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import DotDivider from '@/components/DotDivider' import VideoSourceInfo from '@/components/VideoSourceInfo' @@ -70,7 +70,7 @@ const VideoItem = ({ entry, active, onPreview, accountInfo }) => ( {entry.views} - {cutFrom(entry.desc, 90)} + {cutRest(entry.desc, 90)} diff --git a/src/components/VideoItem/styles/index.ts b/src/components/VideoItem/styles/index.ts index ea9817b40..a456f6129 100755 --- a/src/components/VideoItem/styles/index.ts +++ b/src/components/VideoItem/styles/index.ts @@ -107,7 +107,7 @@ export const BodyDigest = styled.li` } ${css.media.mobile` - ${css.cutFrom('200px')}; + ${css.cutRest('200px')}; `}; ` export const OriginalAuthorLink = styled.a` diff --git a/src/components/WorksCard/index.js b/src/components/WorksCard/index.js index fbff584f4..9e39450a3 100755 --- a/src/components/WorksCard/index.js +++ b/src/components/WorksCard/index.js @@ -8,7 +8,7 @@ import React from 'react' import T from 'prop-types' import { ICON, ICON_CMD } from '@/config' -import { buildLog, cutFrom, nilOrEmpty } from '@/utils' +import { buildLog, cutRest, nilOrEmpty } from '@/utils' import DigestSentence from '@/components/DigestSentence' import { SpaceGrow } from '@/components/Common' @@ -72,7 +72,7 @@ const WorksCard = ({
{title} - {cutFrom(desc, descLimit)} + {cutRest(desc, descLimit)}
diff --git a/src/containers/content/DiscoveryContent/CommunityCard.js b/src/containers/content/DiscoveryContent/CommunityCard.js index d3f6a0bce..9d7429e8b 100755 --- a/src/containers/content/DiscoveryContent/CommunityCard.js +++ b/src/containers/content/DiscoveryContent/CommunityCard.js @@ -2,7 +2,7 @@ import React from 'react' import { contains } from 'ramda' import { NON_FILL_COMMUNITY } from '@/constant' -import { prettyNum, cutFrom } from '@/utils' +import { prettyNum, cutRest } from '@/utils' import TrendLine from '@/components/TrendLine' import { CommunityHolder } from '@/components/LoadingEffects' @@ -32,7 +32,7 @@ const CommunityCard = ({ community, restProps }) => ( /> {community.title} - {cutFrom(community.desc, 20)} + {cutRest(community.desc, 20)} diff --git a/src/containers/content/DiscoveryContent/NotFound.js b/src/containers/content/DiscoveryContent/NotFound.js index d45549b9e..8342d39f8 100755 --- a/src/containers/content/DiscoveryContent/NotFound.js +++ b/src/containers/content/DiscoveryContent/NotFound.js @@ -1,7 +1,7 @@ import React from 'react' import Link from 'next/link' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, @@ -18,7 +18,7 @@ const NotFound = ({ searchValue }) => { 没有找到包含{' '} - {cutFrom(searchValue, 10)} 的社区 + {cutRest(searchValue, 10)} 的社区 若没有你感兴趣的社区, 你可以 diff --git a/src/containers/content/HaveADrinkContent/Body/Catalog.js b/src/containers/content/HaveADrinkContent/Body/Catalog.js index 300ced82f..a0167df9a 100755 --- a/src/containers/content/HaveADrinkContent/Body/Catalog.js +++ b/src/containers/content/HaveADrinkContent/Body/Catalog.js @@ -7,7 +7,7 @@ import React from 'react' import { ICON_CMD } from '@/config' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import { Wrapper, @@ -142,7 +142,7 @@ const Catalog = () => {
{item.title} - {cutFrom(item.lastMsg, 13)} + {cutRest(item.lastMsg, 13)} ))} diff --git a/src/containers/content/JobContent/CommunityCard.js b/src/containers/content/JobContent/CommunityCard.js index 74f45e353..c029b0e0a 100755 --- a/src/containers/content/JobContent/CommunityCard.js +++ b/src/containers/content/JobContent/CommunityCard.js @@ -2,7 +2,7 @@ import React from 'react' import { ICON_CMD } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, Divider, @@ -24,7 +24,7 @@ const CompanyCard = ({ data }) => ( - {cutFrom(data.company, 9)} + {cutRest(data.company, 9)} ( rel="noopener noreferrer" target="_blank" > - {cutFrom(data.companyLink, 30)} + {cutRest(data.companyLink, 30)} diff --git a/src/containers/content/MeetupsContent/ActivityCard.tsx b/src/containers/content/MeetupsContent/ActivityCard.tsx index 670ebc6b6..429b47218 100755 --- a/src/containers/content/MeetupsContent/ActivityCard.tsx +++ b/src/containers/content/MeetupsContent/ActivityCard.tsx @@ -1,7 +1,7 @@ import React from 'react' import { ICON_CMD } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import DotDivider from '@/components/DotDivider' @@ -42,7 +42,7 @@ const ActivityCard: React.FC = ({ item }) => { <Tag>{item.type || '前端'}</Tag> <TitleText finished={item.finished}> - {cutFrom(item.title, 40)} + {cutRest(item.title, 40)} </TitleText> diff --git a/src/containers/content/SubscribeContent/logic.js b/src/containers/content/SubscribeContent/logic.js index eb4a11e97..0f0b6a48c 100755 --- a/src/containers/content/SubscribeContent/logic.js +++ b/src/containers/content/SubscribeContent/logic.js @@ -1,7 +1,7 @@ import { useEffect } from 'react' // import { } from 'ramda' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' // import S from './service' let store = null @@ -26,7 +26,7 @@ export const changeView = (view) => { export const notifyCopy = ({ error, value }) => { const type = !error ? 'info' : 'error' const title = !error ? '已复制到剪切板' : '复制到剪切板出错' - const msg = !error ? cutFrom(value, 10) : error + const msg = !error ? cutRest(value, 10) : error store.toast(type, { title, msg, position: 'topCenter' }) } diff --git a/src/containers/content/WorksContent/styles/banner/recommendation.ts b/src/containers/content/WorksContent/styles/banner/recommendation.ts index 12ef86f7b..a4645952e 100644 --- a/src/containers/content/WorksContent/styles/banner/recommendation.ts +++ b/src/containers/content/WorksContent/styles/banner/recommendation.ts @@ -61,7 +61,7 @@ export const UpNumber = styled.div` ` export const BodyText = styled.div` font-size: 14px; - ${css.cutFrom('350px')}; + ${css.cutRest('350px')}; color: ${theme('thread.articleDigest')}; ` export const FooterWrapper = styled.div` @@ -129,7 +129,7 @@ export const TechIcon = styled(BaseBuildIcon)` // ` // export const BodyText = styled.div` // font-size: 14px; -// ${css.cutFrom('350px')}; +// ${css.cutRest('350px')}; // color: ${theme('thread.articleDigest')}; // ` // export const FooterWrapper = styled.div` diff --git a/src/containers/digest/ArticleDigest/DesktopView/RepoTitle.js b/src/containers/digest/ArticleDigest/DesktopView/RepoTitle.js index 81415530f..b0354f8bd 100755 --- a/src/containers/digest/ArticleDigest/DesktopView/RepoTitle.js +++ b/src/containers/digest/ArticleDigest/DesktopView/RepoTitle.js @@ -2,7 +2,7 @@ import React from 'react' import Tooltip from '@/components/Tooltip' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, LanguageDot, @@ -24,7 +24,7 @@ const RepoTitle = ({ repo }) => (
/ - {cutFrom(repo.title, 20)} + {cutRest(repo.title, 20)} {' '} ) diff --git a/src/containers/digest/CommunityDigest/ExpandTexts.js b/src/containers/digest/CommunityDigest/ExpandTexts.js index 9f0d86d7f..213ccaab0 100644 --- a/src/containers/digest/CommunityDigest/ExpandTexts.js +++ b/src/containers/digest/CommunityDigest/ExpandTexts.js @@ -2,7 +2,7 @@ import React from 'react' import { ICON_CMD } from '@/config' import { useDevice } from '@/hooks' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, @@ -37,7 +37,7 @@ const ExpandTexts = ({ descExpand }) => { ) : ( - {cutFrom(text, cutLength)} + {cutRest(text, cutLength)} diff --git a/src/containers/digest/CommunityDigest/styles/expand_texts.ts b/src/containers/digest/CommunityDigest/styles/expand_texts.ts index 1b40682ce..bcd235f7d 100644 --- a/src/containers/digest/CommunityDigest/styles/expand_texts.ts +++ b/src/containers/digest/CommunityDigest/styles/expand_texts.ts @@ -18,11 +18,11 @@ export const Normal = styled.div<{ margin: string }>` `}; /* ${css.media.tablet` - ${css.cutFrom('220px')}; + ${css.cutRest('220px')}; `}; ${css.media.mobile` - ${css.cutFrom('180px')}; + ${css.cutRest('180px')}; `}; */ ` export const IconWrapper = styled.span` diff --git a/src/containers/editor/PostEditor/RadarNote.js b/src/containers/editor/PostEditor/RadarNote.js index 6d17eb843..46b21654a 100755 --- a/src/containers/editor/PostEditor/RadarNote.js +++ b/src/containers/editor/PostEditor/RadarNote.js @@ -2,7 +2,7 @@ import React from 'react' import { ISSUE_ADDR } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, Title, @@ -50,7 +50,7 @@ const RadarNote = () => ( rel="noopener noreferrer" target="_blank" > - {cutFrom(item.link, 18)} + {cutRest(item.link, 18)} @@ -63,7 +63,7 @@ const RadarNote = () => ( rel="noopener noreferrer" target="_blank" > - {cutFrom(`${ISSUE_ADDR}/339`, 100)} + {cutRest(`${ISSUE_ADDR}/339`, 100)}
diff --git a/src/containers/layout/ThemePalette/GlobalStyle.ts b/src/containers/layout/ThemePalette/GlobalStyle.ts index 59ac0fd50..cd80bcd00 100755 --- a/src/containers/layout/ThemePalette/GlobalStyle.ts +++ b/src/containers/layout/ThemePalette/GlobalStyle.ts @@ -112,7 +112,7 @@ const GlobalStyle = createGlobalStyle` display: inline-block; margin-left: 8px; - ${css.cutFrom('200px')}; + ${css.cutRest('200px')}; max-width: 368px; font-size: 1rem; margin-bottom: 0.2em; diff --git a/src/containers/tool/ArticleSticker/LeftSticker/Toc.js b/src/containers/tool/ArticleSticker/LeftSticker/Toc.js index d35de2c9c..bbed82d0c 100644 --- a/src/containers/tool/ArticleSticker/LeftSticker/Toc.js +++ b/src/containers/tool/ArticleSticker/LeftSticker/Toc.js @@ -1,7 +1,7 @@ import React from 'react' import { ICON } from '@/config' -// import { cutFrom } from '@/utils' +// import { cutRest } from '@/utils' import { Wrapper, HeaderWrapper, diff --git a/src/containers/tool/ArticleSticker/LeftSticker/index.js b/src/containers/tool/ArticleSticker/LeftSticker/index.js index 84b74d253..1d8f95547 100644 --- a/src/containers/tool/ArticleSticker/LeftSticker/index.js +++ b/src/containers/tool/ArticleSticker/LeftSticker/index.js @@ -1,7 +1,7 @@ import React from 'react' import { ICON } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import Toc from './Toc' @@ -20,7 +20,7 @@ const LeftSticker = ({ show, title, isTocMenuOpened }) => { Elixir 社区 - {cutFrom(title, 30)} + {cutRest(title, 30)} ) diff --git a/src/containers/tool/CommunitySetter/styles/community.ts b/src/containers/tool/CommunitySetter/styles/community.ts index c4549fcbf..85f1cff04 100755 --- a/src/containers/tool/CommunitySetter/styles/community.ts +++ b/src/containers/tool/CommunitySetter/styles/community.ts @@ -18,7 +18,7 @@ export const Logo = styled(Img)` ` export const Title = styled.div` color: ${theme('thread.articleDigest')}; - ${css.cutFrom('100px')}; + ${css.cutRest('100px')}; ${Wrapper}:hover & { color: ${theme('thread.articleTitle')}; diff --git a/src/containers/tool/Doraemon/AlertBar.js b/src/containers/tool/Doraemon/AlertBar.js index 648557210..bd2f61f12 100755 --- a/src/containers/tool/Doraemon/AlertBar.js +++ b/src/containers/tool/Doraemon/AlertBar.js @@ -1,7 +1,7 @@ import React from 'react' import { ICON_CMD } from '@/config' -import { cutFrom, Trans } from '@/utils' +import { cutRest, Trans } from '@/utils' import { Wrapper, WarningIcon, Info, Title, Desc } from './styles/alert_bar' const AlertBar = ({ value, searchThread }) => ( @@ -11,7 +11,7 @@ const AlertBar = ({ value, searchThread }) => ( 未找到您需要的 {Trans(searchThread)} " - {cutFrom(value, 20)} + {cutRest(value, 20)} " 请尝试其他关键字或查看帮助文档 diff --git a/src/containers/tool/Doraemon/logic/index.js b/src/containers/tool/Doraemon/logic/index.js index cdab3f56e..a580e6e88 100755 --- a/src/containers/tool/Doraemon/logic/index.js +++ b/src/containers/tool/Doraemon/logic/index.js @@ -10,7 +10,7 @@ import { Global, send, prettyNum, - cutFrom, + cutRest, errRescue, } from '@/utils' @@ -283,7 +283,7 @@ const DataSolver = [ (e) => ({ id: e.id, raw: `repo-raw-${e.id}`, - title: `${e.ownerName} / ${cutFrom(e.title, 30)}`, + title: `${e.ownerName} / ${cutRest(e.title, 30)}`, desc: `star:${prettyNum(e.starCount)} ${e.desc}`, }), searchRepos.entries, diff --git a/src/containers/tool/Doraemon/styles/results_list.ts b/src/containers/tool/Doraemon/styles/results_list.ts index d9db2fe75..e13558257 100755 --- a/src/containers/tool/Doraemon/styles/results_list.ts +++ b/src/containers/tool/Doraemon/styles/results_list.ts @@ -104,16 +104,16 @@ export const Title = styled.div` color: ${theme('shell.link')}; } - ${css.cutFrom('400px')}; + ${css.cutRest('400px')}; ${css.media.mobile` - ${css.cutFrom('200px')}; + ${css.cutRest('200px')}; `}; ` export const Desc = styled.div` color: ${theme('shell.desc')}; font-size: 0.9rem; - ${css.cutFrom('400px')}; + ${css.cutRest('400px')}; ` export const Hint = styled.div` color: ${theme('shell.desc')}; diff --git a/src/containers/tool/FavoritesCats/CategoryCardList.js b/src/containers/tool/FavoritesCats/CategoryCardList.js index 79f6615b7..0ebfc9dfa 100755 --- a/src/containers/tool/FavoritesCats/CategoryCardList.js +++ b/src/containers/tool/FavoritesCats/CategoryCardList.js @@ -1,6 +1,6 @@ import React from 'react' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import Folder from '@/components/Folder' import Pagi from '@/components/Pagi' @@ -18,8 +18,8 @@ const CategoryCardList = ({ {entries.map((cat) => ( switchToUpdater(cat)} diff --git a/src/containers/tool/Informer/Header.js b/src/containers/tool/Informer/Header.js index 056ed87fd..2f8cd585b 100755 --- a/src/containers/tool/Informer/Header.js +++ b/src/containers/tool/Informer/Header.js @@ -1,11 +1,11 @@ import React from 'react' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper } from './styles/header' const Header = ({ data }) => ( -
【 {cutFrom(data.title, 15)} 】
+
【 {cutRest(data.title, 15)} 】
) diff --git a/src/containers/tool/MailBox/MentionList.js b/src/containers/tool/MailBox/MentionList.js index af05d9ce0..77df65141 100755 --- a/src/containers/tool/MailBox/MentionList.js +++ b/src/containers/tool/MailBox/MentionList.js @@ -3,7 +3,7 @@ import { isEmpty } from 'ramda' import EmptyLabel from '@/components/EmptyLabel' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, ListsWrapper, @@ -80,7 +80,7 @@ const MentionList = ({ data }) => { previewUser(item.fromUser)}> - {cutFrom(item.fromUser.nickname, 8)} + {cutRest(item.fromUser.nickname, 8)} diff --git a/src/containers/tool/MailBox/styles/mention_list.ts b/src/containers/tool/MailBox/styles/mention_list.ts index b8fd9be43..b86396fd1 100755 --- a/src/containers/tool/MailBox/styles/mention_list.ts +++ b/src/containers/tool/MailBox/styles/mention_list.ts @@ -66,7 +66,7 @@ export const TypeLabel = styled.div` ` export const SourceTitle = styled.div` color: ${theme('thread.articleTitle')}; - ${css.cutFrom('180px')}; + ${css.cutRest('180px')}; font-size: 0.9rem; &:hover { cursor: pointer; @@ -83,7 +83,7 @@ export const SourcePreview = styled.div` ` export const PreviewBody = styled.div` font-style: italic; - ${css.cutFrom('250px')}; + ${css.cutRest('250px')}; ` export const AtLabel = styled.span` font-style: normal; diff --git a/src/containers/unit/ArticleAuthorCard/UserInfo.js b/src/containers/unit/ArticleAuthorCard/UserInfo.js index a57320490..e791ea8d1 100755 --- a/src/containers/unit/ArticleAuthorCard/UserInfo.js +++ b/src/containers/unit/ArticleAuthorCard/UserInfo.js @@ -1,7 +1,7 @@ import React from 'react' import T from 'prop-types' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { FollowButton } from '@/components/Buttons' import { Wrapper, Avatar, Brief, Nickname, Bio } from './styles/user_info' @@ -22,7 +22,7 @@ const UserInfo = ({ user, isSelfViewing }) => ( /> )} - {cutFrom(user.bio || '--', 35)} + {cutRest(user.bio || '--', 35)} ) diff --git a/src/containers/unit/ArticleBodyHeader/Linker.js b/src/containers/unit/ArticleBodyHeader/Linker.js index 772d408ce..8f32f690f 100755 --- a/src/containers/unit/ArticleBodyHeader/Linker.js +++ b/src/containers/unit/ArticleBodyHeader/Linker.js @@ -1,7 +1,7 @@ import React from 'react' // import { ICON_CMD } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { LinkFrom, LinkSource } from './styles' const Linker = ({ addr }) => ( @@ -9,7 +9,7 @@ const Linker = ({ addr }) => ( {addr && (
原文地址: 
- {cutFrom(addr, 30)} + {cutRest(addr, 30)}
)} diff --git a/src/containers/unit/ArticleViewerHeader/CompanyInfo.js b/src/containers/unit/ArticleViewerHeader/CompanyInfo.js index b96500495..e7a57b4c6 100755 --- a/src/containers/unit/ArticleViewerHeader/CompanyInfo.js +++ b/src/containers/unit/ArticleViewerHeader/CompanyInfo.js @@ -4,7 +4,7 @@ import TimeAgo from 'timeago-react' import DotDivider from '@/components/DotDivider' import { ICON_CMD } from '@/config' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { Wrapper, Logo, @@ -20,7 +20,7 @@ const CompanyInfo = ({ company, insertedAt, author }) => (
- {cutFrom(company.title, 14)} + {cutRest(company.title, 14)} { return ( - {cutFrom(data.author.nickname, 6)}:{data.body} + {cutRest(data.author.nickname, 6)}:{data.body} #{data.floor} ) diff --git a/src/containers/unit/Comments/ReplyToBar.js b/src/containers/unit/Comments/ReplyToBar.js index 92bcf277d..217e76462 100755 --- a/src/containers/unit/Comments/ReplyToBar.js +++ b/src/containers/unit/Comments/ReplyToBar.js @@ -2,7 +2,7 @@ import React from 'react' // import { ICON_CMD } from '@/config' // import { Wrapper } from './styles' -import { cutFrom } from '@/utils' +import { cutRest } from '@/utils' import { ReplyBar, ReplyToBody, ReplyToFloor } from './styles/reply_to_bar' const ReplyToBar = ({ comment }) => { @@ -10,7 +10,7 @@ const ReplyToBar = ({ comment }) => { return ( 回复  - {cutFrom(comment.author.nickname, 10)}: + {cutRest(comment.author.nickname, 10)}: {comment.body} #{comment.floor} diff --git a/src/containers/unit/Comments/styles/comment/base.ts b/src/containers/unit/Comments/styles/comment/base.ts index 7ae0b33ba..a0a45b89b 100755 --- a/src/containers/unit/Comments/styles/comment/base.ts +++ b/src/containers/unit/Comments/styles/comment/base.ts @@ -19,10 +19,10 @@ export const ReplyToBodyBase = styled.span` flex-grow: 1; font-style: italic; - ${css.cutFrom('350px')}; + ${css.cutRest('350px')}; ${css.media.mobile` - ${css.cutFrom('125px')}; + ${css.cutRest('125px')}; `}; ` export const ReplyToFloorBase = styled.div` diff --git a/src/containers/unit/Comments/styles/index.ts b/src/containers/unit/Comments/styles/index.ts index ba2983b19..d95a7ed6d 100755 --- a/src/containers/unit/Comments/styles/index.ts +++ b/src/containers/unit/Comments/styles/index.ts @@ -21,10 +21,10 @@ export const ReplyToBodyBase = styled.div` flex-grow: 1; font-style: italic; - ${css.cutFrom('350px')}; + ${css.cutRest('350px')}; ${css.media.mobile` - ${css.cutFrom('120px')}; + ${css.cutRest('120px')}; `}; ` export const ReplyToFloorBase = styled.div` diff --git a/src/containers/unit/ModeLine/styles/bottom_bar/community_info.ts b/src/containers/unit/ModeLine/styles/bottom_bar/community_info.ts index f01346437..678133f2d 100644 --- a/src/containers/unit/ModeLine/styles/bottom_bar/community_info.ts +++ b/src/containers/unit/ModeLine/styles/bottom_bar/community_info.ts @@ -15,7 +15,7 @@ export const Logo = styled(Img)<{ isExpand: boolean }>` transition: all 0.25s; ` export const Title = styled.div<{ isSubscribed: boolean }>` - ${css.cutFrom('50px')}; + ${css.cutRest('50px')}; color: ${({ isSubscribed }) => (isSubscribed ? '#b4e1e2' : '#a0bebf')}; font-size: 12px; margin-left: 8px; diff --git a/src/containers/unit/ModeLine/styles/top_bar/mobile_view/article_bar/index.ts b/src/containers/unit/ModeLine/styles/top_bar/mobile_view/article_bar/index.ts index 9ec30b98b..6ffb8a432 100644 --- a/src/containers/unit/ModeLine/styles/top_bar/mobile_view/article_bar/index.ts +++ b/src/containers/unit/ModeLine/styles/top_bar/mobile_view/article_bar/index.ts @@ -39,5 +39,5 @@ export const Title = styled.div` color: ${theme('thread.articleTitle')}; font-size: 13px; margin-left: 12px; - ${css.cutFrom('60vw')}; + ${css.cutRest('60vw')}; ` diff --git a/src/containers/unit/TagsBar/styles/desktop_view/folder.ts b/src/containers/unit/TagsBar/styles/desktop_view/folder.ts index 9c37aa0da..b2d86cd61 100644 --- a/src/containers/unit/TagsBar/styles/desktop_view/folder.ts +++ b/src/containers/unit/TagsBar/styles/desktop_view/folder.ts @@ -29,7 +29,7 @@ export const Title = styled.div` margin-left: 4px; font-size: 14px; margin-right: 8px; - ${css.cutFrom('85px')}; + ${css.cutRest('85px')}; ${Header}:hover & { opacity: 0.65; diff --git a/src/containers/unit/TagsBar/styles/desktop_view/tag_item.ts b/src/containers/unit/TagsBar/styles/desktop_view/tag_item.ts index df0d088d7..0ab6a9507 100644 --- a/src/containers/unit/TagsBar/styles/desktop_view/tag_item.ts +++ b/src/containers/unit/TagsBar/styles/desktop_view/tag_item.ts @@ -51,7 +51,7 @@ export const TagTitle = styled.div` letter-spacing: 2px; font-weight: ${({ active }) => (active ? 'bold' : 'normal')}; opacity: ${({ active }) => (active ? 1 : 0.9)}; - ${({ inline }) => (!inline ? css.cutFrom('120px') : css.cutFrom('50px'))}; + ${({ inline }) => (!inline ? css.cutRest('120px') : css.cutRest('50px'))}; &:hover { cursor: pointer; @@ -60,7 +60,7 @@ export const TagTitle = styled.div` } ${TagsWrapper}:hover & { - ${css.cutFrom('80px')}; + ${css.cutRest('80px')}; } transition: all 0.2s; diff --git a/src/containers/user/UserLister/UserList.js b/src/containers/user/UserLister/UserList.js index 8ae3a8828..e1c69902a 100755 --- a/src/containers/user/UserLister/UserList.js +++ b/src/containers/user/UserLister/UserList.js @@ -8,7 +8,7 @@ import React from 'react' import T from 'prop-types' import { ICON_CMD } from '@/config' -import { buildLog, cutFrom } from '@/utils' +import { buildLog, cutRest } from '@/utils' import Pagi from '@/components/Pagi' import { FollowButton } from '@/components/Buttons' @@ -40,7 +40,7 @@ const UsersTable = ({ entries, accountId }) => ( {user.nickname} - {cutFrom(user.location || user.geoCity || '--', 16)} + {cutRest(user.location || user.geoCity || '--', 16)} diff --git a/src/containers/user/UserLister/styles/user_list.ts b/src/containers/user/UserLister/styles/user_list.ts index 98a0ed0e3..0d36499a5 100755 --- a/src/containers/user/UserLister/styles/user_list.ts +++ b/src/containers/user/UserLister/styles/user_list.ts @@ -48,13 +48,13 @@ export const Location = styled.div` margin-left: 10px; ${css.media.tablet` - ${css.cutFrom('80px')}; + ${css.cutRest('80px')}; margin-left: 0; margin-bottom: 3px; `}; ${css.media.mobile` - ${css.cutFrom('60px')}; + ${css.cutRest('60px')}; margin-left: 0; margin-bottom: 3px; `}; diff --git a/src/containers/viewer/MailsViewer/styles/mention_list.ts b/src/containers/viewer/MailsViewer/styles/mention_list.ts index a446981ce..273529d06 100755 --- a/src/containers/viewer/MailsViewer/styles/mention_list.ts +++ b/src/containers/viewer/MailsViewer/styles/mention_list.ts @@ -78,7 +78,7 @@ export const TypeLabel = styled.div` ` export const SourceTitle = styled.div` color: ${theme('thread.articleTitle')}; - ${css.cutFrom('350px')}; + ${css.cutRest('350px')}; font-size: 0.9rem; &:hover { cursor: pointer; @@ -97,7 +97,7 @@ export const SourcePreview = styled.div` export const PreviewBody = styled.div` flex-grow: 1; font-style: italic; - ${css.cutFrom('400px')}; + ${css.cutRest('400px')}; ` export const AtLabel = styled.span` margin-left: 3px; diff --git a/utils/css/index.ts b/utils/css/index.ts index f40fcb83a..ec61d44d8 100644 --- a/utils/css/index.ts +++ b/utils/css/index.ts @@ -22,7 +22,7 @@ const smokey = (initOpacity = 0.6): string => ` } transition: opacity 0.2s; ` -const cutFrom = (width = '100px'): string => ` +const cutRest = (width = '100px'): string => ` width: ${width}; white-space: nowrap; overflow: hidden; @@ -39,7 +39,7 @@ const threadTitleHover = (): CSSProp => { } const css = { - cutFrom, + cutRest, circle, size, smokey, diff --git a/utils/helper.ts b/utils/helper.ts index 6732e1936..c23a35372 100755 --- a/utils/helper.ts +++ b/utils/helper.ts @@ -67,7 +67,7 @@ export const Rlog = (arg = 'Rlog: ') => tap(log(arg)) * @param {*string} str 需要进行处理的字符串,可含汉字 * @param {*number} len 需要显示多少个汉字,两个英文字母相当于一个汉字 */ -export const cutFrom = (str: string, len = 20): string => { +export const cutRest = (str: string, len = 20): string => { if (!str || !isString(str)) return '??...' return len >= length(str) ? str : `${limit(str, len, '')}...` } diff --git a/utils/index.ts b/utils/index.ts index 8a73a239d..6074f7071 100755 --- a/utils/index.ts +++ b/utils/index.ts @@ -19,7 +19,7 @@ export { send, mapKeys, getRandomInt, - cutFrom, + cutRest, prettyNum, numberWithCommas, sortByColor,