Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: redesign the transcript word limit more and less text #1301

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/components/App/SideBar/Transcript/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import styled from 'styled-components'
import CopyIcon from '~/components/Icons/CopyIcon'
import NotesIcon from '~/components/Icons/NotesIcon'
import { Flex } from '~/components/common/Flex'
import { getFullTranscript } from '~/network/fetchSourcesData'
import { useAppStore } from '~/stores/useAppStore'
import { NodeExtended } from '~/types'
import { colors } from '~/utils/colors'
import CheckIcon from '../../../Icons/CheckIcon'
import { getFullTranscript } from '~/network/fetchSourcesData'

type TranscriptProps = {
stateless?: boolean
Expand All @@ -19,9 +19,13 @@ type TranscriptProps = {
const MoreText = styled.span`
color: ${colors.white};
cursor: pointer;
margin-left: 5px;
text-transform: uppercase;
font-weight: 500;
font-size: 12px;
text-align: right;

&:hover {
text-decoration: underline;
color: ${colors.GRAY3};
}
`

Expand Down Expand Up @@ -122,8 +126,8 @@ export const Transcript = ({ stateless, node }: TranscriptProps) => {
)}
</Header>
<Box>
{showFullTranscript ? fullTranscript : `${node?.text?.substring(0, 100)}...`}
<MoreText onClick={handleMoreClick}>{showFullTranscript ? 'less' : 'more'}</MoreText>
{showFullTranscript ? fullTranscript : `${node?.text?.substring(0, 100)}`}
<MoreText onClick={handleMoreClick}>... {showFullTranscript ? 'show less' : 'more'}</MoreText>
</Box>
</Flex>
)
Expand Down Expand Up @@ -169,7 +173,6 @@ const CloseButton = styled(Flex).attrs({})`

const Box = styled(Flex)`
color: ${colors.white};
text-overflow: ellipsis;
whitespace: nowrap;
font-family: Barlow;
letter-spacing: 0.2pt;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { render, screen, waitFor } from '@testing-library/react'
import React from 'react'
import { GraphBlueprint } from '../index'

jest.mock('../../../../../network/fetchSourcesData', () => ({
Expand All @@ -15,8 +15,10 @@ describe('GraphBlueprint', () => {
it('should display only one Custom node', async () => {
render(<GraphBlueprint />)

const customNodes = await screen.findAllByText('Custom')
waitFor(async () => {
const customNodes = await screen.findAllByText('Custom')

expect(customNodes).toHaveLength(1)
expect(customNodes).toHaveLength(1)
})
})
})
Loading