-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add widget breadcrumb * Fix linting issues * Apply eslint-fixer changes * Fix border-color token * Automatic frontend build --------- Co-authored-by: vin0401 <[email protected]>
- Loading branch information
Showing
46 changed files
with
2,370 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
assets/js/src/core/components/filename/filename.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import { type StoryObj, type Meta } from '@storybook/react' | ||
import { Filename, type FilenameProps } from './filename' | ||
|
||
const config: Meta = { | ||
title: 'Components/Data Display/Filename', | ||
component: Filename, | ||
tags: ['autodocs'] | ||
} | ||
|
||
export default config | ||
|
||
export const _default: StoryObj<FilenameProps> = { | ||
args: { | ||
value: 'filename.jpg', | ||
ellipsis: false | ||
} | ||
} | ||
|
||
export const Ellipsis = { | ||
args: { | ||
value: 'Lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr-sed-diam-nonumy-eirmod-tempor-invidunt-ut-labore-et-dolore-magna-aliquyam-erat-sed-diam-voluptua.jpg', | ||
ellipsis: true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import React from 'react' | ||
import { Text } from '../text/text' | ||
import { Flex } from '../flex/flex' | ||
|
||
export interface FilenameProps extends React.HTMLAttributes<HTMLDivElement> { | ||
value: string | ||
ellipsis?: boolean | ||
} | ||
|
||
export const Filename = ({ value, ellipsis, ...props }: FilenameProps): React.JSX.Element => { | ||
const filename = value | ||
const hasExtension = filename.includes('.') | ||
|
||
if (hasExtension && ellipsis === true) { | ||
const parts = filename.split('.') | ||
const extension = parts.pop() | ||
const name = parts.join('.') | ||
|
||
return ( | ||
<Flex { ...props }> | ||
<Text | ||
ellipsis={ ellipsis ? { tooltip: { title: filename, overlayStyle: { maxWidth: 'min(100%, 500px)' }, mouseEnterDelay: 0.3 } } : false } | ||
style={ { color: 'inherit' } } | ||
>{name}</Text>. | ||
<Text style={ { whiteSpace: 'nowrap', color: 'inherit' } }>{extension}</Text> | ||
</Flex> | ||
) | ||
} | ||
|
||
return ( | ||
<Text | ||
ellipsis={ ellipsis } | ||
{ ...props } | ||
>{ filename }</Text> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.