Skip to content

Commit

Permalink
refactor: update main with changes from next
Browse files Browse the repository at this point in the history
refactor: getting rid of next
  • Loading branch information
jared-dickman authored Mar 14, 2024
2 parents 2ad4075 + 2147e0f commit 4450abd
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 44 deletions.
2 changes: 1 addition & 1 deletion design/GlobalToken.json
Original file line number Diff line number Diff line change
Expand Up @@ -1160,4 +1160,4 @@
"boxShadowTabsOverflowBottom": {
"value": "inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@
"path": "./node_modules/cz-conventional-changelog"
}
}
}
}
2 changes: 1 addition & 1 deletion src/assets/svg/alicorn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/data-display/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ export const ExampleAutosetFontSize: Story = {
</ExampleStory>
)
},
}
}
2 changes: 1 addition & 1 deletion src/components/data-display/Empty/Empty.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ export const ExampleGlobalEmpty: Story = {
</ExampleStory>
)
},
}
}
2 changes: 1 addition & 1 deletion src/components/feedback/Progress/Progress.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,4 @@ export const ExampleProgressSize: Story = {
</ExampleStory>
)
},
}
}
10 changes: 8 additions & 2 deletions src/components/general/Typography/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Switch } from 'src/components'
import { Text } from 'src/components/general/Typography/Typography'
import { ExampleStory } from 'src/utils/ExampleStory'
import { useState } from 'react'
import { expect } from '@storybook/test'

const meta: Meta<typeof Text> = {
title: 'Aquarium/General/Text',
Expand Down Expand Up @@ -43,7 +44,12 @@ type Story = StoryObj<typeof Text>
Customize the stories based on specific requirements.
*/

export const Primary: Story = {}
export const Primary: Story = {
play: async context => {
const text = context.canvasElement.querySelector('span')
void expect(text?.textContent).toEqual('Example Text')
},
}

export const Code: Story = {
args: {
Expand Down Expand Up @@ -188,4 +194,4 @@ export const ExampleEllipsis: Story = {
</ExampleStory>
)
},
}
}
2 changes: 1 addition & 1 deletion src/components/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ export {
CircleNodesIcon,
CloudIcon,
FolderClosedIcon,
}
}
2 changes: 1 addition & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ export {
CircleNodesIcon,
CloudIcon,
FolderClosedIcon,
} from './icons/index'
} from './icons/index'
Original file line number Diff line number Diff line change
Expand Up @@ -914,4 +914,4 @@ export const Cortex: Story = {
alert('going to overview map')
},
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ export const GlobalNavigation = (props: IGlobalNavigationProps) => {
</Layout.Sider>
</Layout>
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getInitials } from 'src/utils/utils'
import { type InputRef } from 'antd'
import { WorkspaceSelectorContent } from 'src/components/navigation/GlobalNavigation/WorkspaceSelector/WorkspaceSelectorContent'
import { useMount } from 'src/hooks/useMount'
import { PaddingXxs } from "src/styles/style";
import { PaddingXxs } from 'src/styles/style'

export interface IWorkspaceSelectorProps {
orgs: INavigationOrg[]
Expand Down Expand Up @@ -255,4 +255,4 @@ export function WorkspaceSelector(props: IWorkspaceSelectorProps) {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export interface IWorkspaceSelectorDisplayItem extends MenuItemType {
accounts?: INavigationAccount[]
workspaces?: INavigationWorkspace[]
isActive?: boolean
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
height: var(--size-sm);
}


.workspaceSelector__orgName,
.workspaceSelector__accountName {
pointer-events: none; /* only workspaces are clickable */
Expand Down Expand Up @@ -130,4 +129,4 @@

.workspaceSelector__signoutButton {
width: 100%;
}
}
2 changes: 1 addition & 1 deletion src/styles/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Then open the story `GetGlobalToken` to retrieve the latest global design token

Then paste that into [GlobalTokens.json](https://github.com/mParticle/aquarium/blob/main/design/GlobalToken.json)

These will then be converted into css variables on push, and committed via the [github action](https://github.com/mParticle/aquarium/blob/main/.github/workflows/tokens-to-css.yml)
These will then be converted into css variables on push, and committed via the [github action](https://github.com/mParticle/aquarium/blob/main/.github/workflows/tokens-to-css.yml)
2 changes: 1 addition & 1 deletion src/styles/style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Do not edit directly
* Generated on Thu, 14 Mar 2024 23:28:17 GMT
* Generated on Thu, 14 Mar 2024 23:33:29 GMT
*/

export const Blue = "#1677ff";
Expand Down
49 changes: 25 additions & 24 deletions src/utils/GetGlobalToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,34 @@ export function GetGlobalToken(): React.ReactNode {

function wrapValuesInObject(obj: AliasToken) {
return Object.fromEntries(
Object.entries(obj).map(([key, value]) => {
const pxKeys = ['padding', 'margin', 'borderRadius', 'screen', 'size', 'font', 'width', 'height']
const excludePxKeys = ['lineHeight', 'fontWeight']

const addPx =
typeof value === 'number' &&
pxKeys.some(k => (key + '').toLowerCase().includes(k.toLowerCase())) &&
!excludePxKeys.some(k => (key + '').toLowerCase().includes(k.toLowerCase()))

if (addPx) value += 'px'

// remove newlines [from properties like box-shadow]
if (typeof value === 'string') value = value.replace(/[\r\n]/gm, '')

// remove deprecated color key syntax - https://ant.design/changelog#530
const regex = /-([1-9]|10)$/
if (regex.test(key)) {
console.log(key)
return [null, { value }]
}
return [key, { value }]
})
.filter(([key]) => key !== null),
Object.entries(obj)
.map(([key, value]) => {
const pxKeys = ['padding', 'margin', 'borderRadius', 'screen', 'size', 'font', 'width', 'height']
const excludePxKeys = ['lineHeight', 'fontWeight']

const addPx =
typeof value === 'number' &&
pxKeys.some(k => (key + '').toLowerCase().includes(k.toLowerCase())) &&
!excludePxKeys.some(k => (key + '').toLowerCase().includes(k.toLowerCase()))

if (addPx) value += 'px'

// remove newlines [from properties like box-shadow]
if (typeof value === 'string') value = value.replace(/[\r\n]/gm, '')

// remove deprecated color key syntax - https://ant.design/changelog#530
const regex = /-([1-9]|10)$/
if (regex.test(key)) {
console.log(key)
return [null, { value }]
}
return [key, { value }]
})
.filter(([key]) => key !== null),
)
}

const globalToken = wrapValuesInObject(getDesignToken(LightTheme))

return <>{JSON.stringify(globalToken, null, 1)}</>
}
}
2 changes: 1 addition & 1 deletion style-dictionary.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
]
}
}
}
}

0 comments on commit 4450abd

Please sign in to comment.