Skip to content

Commit

Permalink
fix(Card): set border radius to large (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenphi authored Dec 23, 2024
1 parent 4cb5839 commit 9dc27fe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
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

0 comments on commit 9dc27fe

Please sign in to comment.