Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/shiny-eagles-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cube-dev/ui-kit': patch
---

Update border radius size for Card and CopySnippet components.
2 changes: 1 addition & 1 deletion src/components/content/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CardElement = tasty({
styles: {
display: 'block',
flow: 'column',
radius: '1r',
radius: '(@large-radius + 1bw)',
fill: '#white',
border: true,
padding: '1.5x',
Expand Down
26 changes: 9 additions & 17 deletions src/components/content/CopySnippet/CopySnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const CopySnippetElement = tasty(Card, {
styles: {
display: 'block',
fill: '#grey-light',
radius: '1r',
radius: '@large-radius',
border: 0,
padding: 0,

Expand All @@ -82,7 +82,7 @@ const CopySnippetElement = tasty(Card, {
flow: 'row',
gridColumns: 'minmax(0, 1fr) auto',
width: 'min 20x',
radius: '1r',
radius: '@large-radius',
position: 'relative',
overflow: 'hidden',
},
Expand Down Expand Up @@ -151,6 +151,10 @@ export interface CubeCopySnippetProps extends CubeCardProps {
// const HIDDEN_SYMBOL = '●';
const HIDDEN_SYMBOL = '•';

function replaceSymbolsToHidden(str: string) {
return HIDDEN_SYMBOL.repeat(str.length);
}

function CopySnippet(allProps: CubeCopySnippetProps) {
const {
code = '',
Expand Down Expand Up @@ -190,29 +194,17 @@ function CopySnippet(allProps: CubeCopySnippetProps) {

if (!showHidden) {
if (hideText === true) {
formattedCode = formattedCode
.split('')
.map((s) => HIDDEN_SYMBOL)
.join('')
.trim();
formattedCode = replaceSymbolsToHidden(formattedCode);
} else if (typeof hideText === 'string') {
formattedCode = formattedCode.replaceAll(
hideText,
hideText
.split('')
.map((s) => HIDDEN_SYMBOL)
.join('')
.trim(),
replaceSymbolsToHidden(hideText),
);
} else if (Array.isArray(hideText)) {
hideText.forEach((text) => {
formattedCode = formattedCode.replaceAll(
text,
text
.split('')
.map((s) => HIDDEN_SYMBOL)
.join('')
.trim(),
replaceSymbolsToHidden(text),
);
});
}
Expand Down
Loading