-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve the code component by adding variants
- Loading branch information
Showing
8 changed files
with
69 additions
and
6 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
13 changes: 13 additions & 0 deletions
13
apps/docs/src/app/_components/playground/code/codeTransform.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,13 @@ | ||
import { Code } from '@pillar-ui/core' | ||
|
||
export const CodeTransform = () => { | ||
return ( | ||
<> | ||
<Code>css cascade</Code> | ||
<Code transform="capitalize">css cascade</Code> | ||
<Code transform="capitalize-once">css cascade</Code> | ||
<Code transform="lowercase">css cascade</Code> | ||
<Code transform="uppercase">css cascade</Code> | ||
</> | ||
) | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/docs/src/app/_components/playground/code/codeVariant.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,12 @@ | ||
import { Code } from '@pillar-ui/core' | ||
|
||
export const CodeVariant = () => { | ||
return ( | ||
<> | ||
<Code variant="solid">{`console.log('Hello world Every thing is OK')`}</Code> | ||
<Code variant="mixed">{`console.log('Hello world Every thing is OK')`}</Code> | ||
<Code variant="soft">{`console.log('Hello world Every thing is OK')`}</Code> | ||
<Code variant="outline">{`console.log('Hello world Every thing is OK')`}</Code> | ||
</> | ||
) | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
.co- { | ||
width: fit-content; | ||
display: inline-block; | ||
padding: 0.125rem 0.5rem; | ||
padding: 0 0.25rem; | ||
line-height: 1.5; | ||
/* | ||
These properties serve as fallbacks. If the corresponding utility functions are | ||
unavailable, these properties take priority. However, if specific props related to | ||
Code are provided, they will override these properties. | ||
*/ | ||
border-radius: var(--code-rad, 0.125em); | ||
font-size: var(--code-size, 0.875rem); | ||
font-size: var(--code-size, 0.85rem); | ||
text-transform: var(--code-transform, capitalize); | ||
} |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import type { ReactNode } from 'react' | ||
import type { Color, Size, Corner, Transform } from '../../types' | ||
import type { Color, Size, Corner, Transform, Variant } from '../../types' | ||
|
||
export interface CodeProps { | ||
children: ReactNode | ||
color?: Color | ||
size?: Size | ||
corner?: Omit<Corner, 'circle'> | ||
transform?: Transform | ||
variant?: Variant | ||
} |
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