Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -3719,13 +3719,13 @@ export const commitDetailsStore: ICommitDetailsStore = {
},
{
content:
"- 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-1 data-[state=active]:text-foreground-1 data-[state=active]:bg-background-1'",
"- 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-2 data-[state=active]:text-foreground-1 data-[state=active]:bg-background-1'",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test

type: 'delete',
oldNumber: 33
},
{
content:
"+ 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-1 data-[state=active]:bg-background-1 data-[state=active]:text-foreground-1'",
"+ 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-2 data-[state=active]:bg-background-1 data-[state=active]:text-foreground-1'",
type: 'insert',
newNumber: 33
},
Expand Down Expand Up @@ -3768,7 +3768,7 @@ export const commitDetailsStore: ICommitDetailsStore = {
contentId: 'content-packages/ui/src/components/tabs.tsx::::packages/ui/src/components/tabs.tsx',
fileId: 'packages/ui/src/components/tabs.tsx::::packages/ui/src/components/tabs.tsx',
filePath: 'packages/ui/src/components/tabs.tsx',
raw: "diff --git a/packages/ui/src/components/tabs.tsx b/packages/ui/src/components/tabs.tsx\nindex 5cbae7da53b01c1fdcd7d7e940e0c2c6c10dfce4..631a8515f53931f3a9ec94f17fb4c3499bef513d 100644\n--- a/packages/ui/src/components/tabs.tsx\n+++ b/packages/ui/src/components/tabs.tsx\n@@ -11,7 +11,7 @@ const tabsListVariants = cva('inline-flex items-center text-foreground-4', {\n underline: 'h-11 justify-center gap-4',\n navigation: 'h-11 w-full justify-start gap-6 border-b border-borders-5 px-6',\n tabnav:\n- 'relative flex w-full before:absolute before:left-0 before:h-px before:w-full before:bg-borders-1 before:bottom-0'\n+ 'relative flex w-full before:absolute before:bottom-0 before:left-0 before:h-px before:w-full before:bg-borders-1'\n }\n },\n defaultVariants: {\n@@ -30,7 +30,7 @@ const tabsTriggerVariants = cva(\n navigation:\n 'm-0 -mb-px h-11 border-b border-solid border-b-transparent px-0 text-xs font-normal text-foreground-2 duration-150 ease-in-out hover:text-foreground-1 data-[state=active]:border-borders-9',\n tabnav:\n- 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-1 data-[state=active]:text-foreground-1 data-[state=active]:bg-background-1'\n+ 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-1 data-[state=active]:bg-background-1 data-[state=active]:text-foreground-1'\n }\n },\n defaultVariants: {\n"
raw: "diff --git a/packages/ui/src/components/tabs.tsx b/packages/ui/src/components/tabs.tsx\nindex 5cbae7da53b01c1fdcd7d7e940e0c2c6c10dfce4..631a8515f53931f3a9ec94f17fb4c3499bef513d 100644\n--- a/packages/ui/src/components/tabs.tsx\n+++ b/packages/ui/src/components/tabs.tsx\n@@ -11,7 +11,7 @@ const tabsListVariants = cva('inline-flex items-center text-foreground-4', {\n underline: 'h-11 justify-center gap-4',\n navigation: 'h-11 w-full justify-start gap-6 border-b border-borders-5 px-6',\n tabnav:\n- 'relative flex w-full before:absolute before:left-0 before:h-px before:w-full before:bg-borders-1 before:bottom-0'\n+ 'relative flex w-full before:absolute before:bottom-0 before:left-0 before:h-px before:w-full before:bg-borders-1'\n }\n },\n defaultVariants: {\n@@ -30,7 +30,7 @@ const tabsTriggerVariants = cva(\n navigation:\n 'm-0 -mb-px h-11 border-b border-solid border-b-transparent px-0 text-xs font-normal text-foreground-2 duration-150 ease-in-out hover:text-foreground-1 data-[state=active]:border-borders-9',\n tabnav:\n- 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-2 data-[state=active]:text-foreground-1 data-[state=active]:bg-background-1'\n+ 'h-[36px] rounded-t-md border-x border-t border-transparent px-3.5 font-normal text-foreground-2 hover:text-foreground-1 data-[state=active]:border-borders-2 data-[state=active]:bg-background-1 data-[state=active]:text-foreground-1'\n }\n },\n defaultVariants: {\n"
},
{
blocks: [
Expand Down
1 change: 1 addition & 0 deletions apps/gitness/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@harnessio/code-service-client": "3.5.0",
"@harnessio/forms": "workspace:*",
"@harnessio/pipeline-graph": "workspace:*",
"@harnessio/core-design-system": "workspace:*",
"@harnessio/ui": "workspace:*",
"@harnessio/views": "workspace:*",
"@harnessio/yaml-editor": "workspace:*",
Expand Down
44 changes: 44 additions & 0 deletions apps/gitness/src/badge-showcase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react'

import { Badge } from '@packages/ui/src/components/badge/badge'

/**
* This component showcases all the different badge variants and themes
* for demonstration purposes.
*/
export const BadgeShowcase = () => {
const variants = ['solid', 'surface', 'soft', 'outline']
const themes = ['success', 'destructive', 'info', 'warning', 'muted']

return (
<div className="p-6 space-y-6">
<h1 className="text-2xl font-bold mb-4">Badge Variants and Themes</h1>

{variants.map(variant => (
<div key={variant} className="space-y-2">
<h2 className="text-lg font-medium capitalize">{variant} Variant</h2>
<div className="flex flex-wrap gap-2">
{themes.map(theme => (
<Badge key={`${variant}-${theme}`} variant={variant as any} theme={theme as any}>
{theme}
</Badge>
))}
</div>
</div>
))}

<div className="mt-8">
<h2 className="text-lg font-medium mb-2">Usage Example</h2>
<pre className="bg-gray-100 p-4 rounded-md text-sm">
{`<Badge variant="solid" theme="success">success</Badge>
<Badge variant="outline" theme="success">success</Badge>
<Badge variant="soft" theme="destructive">destructive</Badge>
<Badge variant="surface" theme="info">info</Badge>
<Badge variant="outline" theme="muted">muted</Badge>`}
</pre>
</div>
</div>
)
}

export default BadgeShowcase
169 changes: 169 additions & 0 deletions apps/gitness/src/test-component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
import { useMemo } from 'react'

import * as styles from '@harnessio/core-design-system/styles-esm'
import { Badge, Text, Tooltip } from '@harnessio/ui/components'

import BadgeShowcase from './badge-showcase'

export default function TestComponent() {
const colorPalette = useMemo(() => {
const shades = Object.keys(styles.colors.colors.blue)

return { shades }
}, [])

return (
<div className="p-8 bg-black text-white max-w-[800px] mx-auto my-6 grid gap-8">
<div>
<Text as="h1" className="text-3xl font-bold mb-2">
Badge
</Text>
<Text as="p" className="mb-10 text-gray-400">
Different Badge variations
</Text>

{/* Original badges */}
{/* <div className="mb-8">
<Text as="h2" className="text-xl font-semibold mb-4">
Original Badge Components
</Text>
{/* Your existing badge examples here */}
{/* </div> */}

{/* New Badge Showcase with Variants and Themes */}
{/* <div className="bg-white text-black rounded-lg p-6">
<BadgeShowcase />
</div> */}

<div className="space-x-2">
<Badge>Default</Badge>
<Badge variant="neutral">neutral</Badge>
<Badge variant="success">Success</Badge>
<Badge variant="warning">warning</Badge>
<Badge variant="danger">danger</Badge>
<Badge variant="info">info</Badge>
<Badge variant="merged">merged</Badge>
<Badge variant="ai">ai</Badge>
</div>

<Text as="p" className="mt-10 mb-5 text-gray-400">
Rounded full
</Text>

<div className="space-x-2">
<Badge borderRadius="full">Default</Badge>
<Badge borderRadius="full" variant="neutral">
neutral
</Badge>
<Badge borderRadius="full" variant="success">
{/* <Icon size={10} name="tick" /> <span>Success</span> */}
Success
</Badge>
<Badge borderRadius="full" variant="warning">
warning
</Badge>
<Badge borderRadius="full" variant="danger">
danger
</Badge>
<Badge borderRadius="full" variant="info">
info
</Badge>
<Badge borderRadius="full" variant="merged">
merged
</Badge>
<Badge borderRadius="full" variant="ai">
ai
</Badge>
</div>

<Text as="p" className="mt-10 mb-5 text-gray-400">
Size sm
</Text>

<div className="space-x-2">
<Badge size="sm">Default</Badge>
<Badge size="sm" variant="neutral">
neutral
</Badge>
<Badge size="sm" variant="success">
{/* <Icon size={10} name="tick" /> <span>Success</span> */}
Success
</Badge>
<Badge size="sm" variant="warning">
warning
</Badge>
<Badge size="sm" variant="danger">
danger
</Badge>
<Badge size="sm" variant="info">
info
</Badge>
<Badge size="sm" variant="merged">
merged
</Badge>
<Badge size="sm" variant="ai">
ai
</Badge>
</div>
</div>

<div style={{ backgroundColor: '#333' }} className="h-1" />

<div>
<Text as="h1" className="text-3xl font-bold mb-2">
Core color palette
</Text>
<Text as="p" className="mb-10 text-gray-400">
The main color used to define the brand or highlight key elements.
</Text>

{/* Shades */}
<div className="flex mb-4">
<div className="w-24"></div> {/* Empty space for color name column */}
{colorPalette.shades.map(shade => (
<div key={shade} className="flex-1 text-center font-medium">
{shade}
</div>
))}
</div>

{/* Colors */}
<div className="space-y-2">
{Object.keys(styles.colors.colors).map(colorName => {
const colorGroup = styles.colors.colors[colorName as keyof typeof styles.colors.colors]

return (
<div key={colorName} className="flex items-center">
<div className="w-24 font-medium capitalize text-white">{colorName}</div>

{colorPalette.shades.map(shade => {
const color = colorGroup[shade as keyof typeof colorGroup]
const colorValue = color?.$value || ''

return (
<div key={shade} className="flex-1 flex justify-center">
<Tooltip.Root>
<Tooltip.Trigger asChild>
<div
className="size-14 rounded-md"
style={{
backgroundColor: colorValue,
border: '1px solid rgba(255,255,255,0.1)'
}}
/>
</Tooltip.Trigger>
<Tooltip.Content style={{ backgroundColor: 'black' }} side="top" align="center">
--{color?.name}: {colorValue}
</Tooltip.Content>
</Tooltip.Root>
</div>
)
})}
</div>
)
})}
</div>
</div>
</div>
)
}
5 changes: 3 additions & 2 deletions packages/core-design-system/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DESIGN_SYSTEM_PREFIX,
DESIGN_SYSTEM_ROOT,
DESIGN_SYSTEM_ROOT_ESM,
ENTERPRISE_STYLES_SOURCE_NAME,
getExportFileHeader,
OSS_STYLES_SOURCE_NAME,
STYLE_BUILD_FORMATS,
Expand Down Expand Up @@ -209,10 +210,10 @@ ${ossLightFiles.map(file => `@import './${file}';`).join('\n')}`
const enterpriseContent = `${getExportFileHeader()}

/* Theme files - Dark */
@import './dark-harness.css';
@import './dark-${ENTERPRISE_STYLES_SOURCE_NAME}.css';

/* Theme files - Light */
@import './light-harness.css';`
@import './light-${ENTERPRISE_STYLES_SOURCE_NAME}.css';`

// Write file
await Promise.all([
Expand Down
3 changes: 2 additions & 1 deletion packages/core-design-system/scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export const THEME_MODE_FILENAME_PREFIX = {
LIGHT: 'light-'
}

export const OSS_STYLES_SOURCE_NAME = 'gitness'
export const OSS_STYLES_SOURCE_NAME = 'oss'
export const ENTERPRISE_STYLES_SOURCE_NAME = 'ent'
29 changes: 23 additions & 6 deletions packages/core-design-system/scripts/sd-file-generators.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ENTERPRISE_STYLES_SOURCE_NAME } from './constants.js'
import { breakpointFilter, componentsFilter, coreFilter, lchColorsFilter, semanticFilter } from './sd-filters.js'

// const format = 'css/variables'
Expand All @@ -9,31 +10,35 @@ export const generateCoreFiles = ({ destination, type, format }) => [
format,
filter: coreFilter,
options: {
outputReferences: false
outputReferences: false,
selector: `:root, :host`
}
},
{
destination: `${destination}/colors.${type}`,
format,
filter: lchColorsFilter,
options: {
outputReferences: true
outputReferences: true,
selector: `:root, :host`
}
},
{
destination: `${destination}/breakpoint.${type}`,
format,
filter: breakpointFilter,
options: {
outputReferences: true
outputReferences: true,
selector: `:root, :host`
}
},
{
destination: `${destination}/components.${type}`,
format,
filter: componentsFilter,
options: {
outputReferences: true
outputReferences: true,
selector: `:root, :host`
}
}
]
Expand All @@ -43,17 +48,29 @@ export const generateThemeFiles = ({ destination, type, theme, format }) => {
const filesArr = []
const themeLower = theme.toLowerCase().replace(/(source-|desktop-)/g, '')

const entityName = themeLower.toLowerCase()

let mfeSupportedClass = ''

if (
entityName === `light-${ENTERPRISE_STYLES_SOURCE_NAME}` ||
entityName === `dark-${ENTERPRISE_STYLES_SOURCE_NAME}`
) {
mfeSupportedClass = '.' + entityName.split('-')[0]
}

// theme-specific outputs
filesArr.push({
format,
filter: semanticFilter(true),
destination: `${destination}/${themeLower.toLowerCase()}.${type}`,
destination: `${destination}/${entityName}.${type}`,
options: {
outputReferences: token => {
// ADD REFERENCE ONLY TO NON-ALPHA TOKENS, ALPHA TOKENS ARE TRANSFORMED AND REFERENCED MANUALLY
return token?.$extensions?.['studio.tokens']?.modify?.type !== 'alpha'
},
selector: `.${themeLower.toLowerCase()}`
// To add .dark for dark-ent and .light for light-ent to support MFE
selector: `.${entityName}${mfeSupportedClass ? ', ' + mfeSupportedClass : ''}`
}
})
return filesArr
Expand Down
42 changes: 0 additions & 42 deletions packages/ui/design-tokens/$metadata.json

This file was deleted.

Loading
Loading