Skip to content

Commit

Permalink
Merge branch 'main' into feat/deprecation-icon-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyzif committed Sep 26, 2024
2 parents 59fdbe3 + 1a870bc commit 5ca1195
Show file tree
Hide file tree
Showing 121 changed files with 17,576 additions and 8,839 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish-storybook-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Storybook PR preview

on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed

concurrency: preview-${{ github.ref }}

jobs:
deploy-preview:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
GIT_AUTHOR_NAME: mparticle-automation
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: mparticle-automation
GIT_COMMITTER_EMAIL: [email protected]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install and Build
if: github.event.action != 'closed' # You might want to skip the build if the PR has been closed
run: |
npm install
npm run build-storybook
touch ./storybook-static/.nojekyll
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./storybook-static/
28 changes: 17 additions & 11 deletions .github/workflows/publish-storybook.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: Publish Storybook

on:
push:
branches:
- 'main' # change to the branch you wish to deploy from

- main
permissions:
contents: read
pages: write
id-token: write

contents: write
jobs:
deploy:
build-and-deploy:
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- id: build-publish
uses: bitovi/[email protected]
- name: Checkout 🛎️
uses: actions/checkout@v4

- name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
run: |
npm ci
npm run build-storybook
touch ./storybook-static/.nojekyll
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
path: storybook-static
folder: storybook-static # The folder the action should deploy.
clean-exclude: pr-preview/
22 changes: 19 additions & 3 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { StorybookConfig } from '@storybook/react-vite'
import react from '@vitejs/plugin-react'
import { PluginOption, Plugin } from 'vite'
import { withoutVitePlugins } from '@storybook/builder-vite'
import remarkGfm from 'remark-gfm'

type StorybookVitePlugins = { plugins: (PluginOption[] | Plugin)[] }

Expand All @@ -11,9 +12,24 @@ const config: StorybookConfig & StorybookVitePlugins = {
options: {},
},

stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],

addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)', '../docs/**/*.stories.@(ts|tsx)', '../docs/**/*.mdx'],

addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
{
name: '@storybook/addon-docs',
options: {
mdxPluginOptions: {
mdxCompileOptions: {
// needed for rendering markdown tables in .mdx
remarkPlugins: [remarkGfm],
},
},
},
},
],

docs: {
autodocs: true,
Expand Down
16 changes: 0 additions & 16 deletions .storybook/preview.ts

This file was deleted.

40 changes: 40 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Preview } from '@storybook/react'

const preview: Preview = {
parameters: {
layout: 'centered',
options: {
storySort: {
order: [
'About',
['Introduction', 'Changelog', 'FAQ'],
'Component Process',
[
'Introduction',
'Components',
['Using components', 'Change process'],
'Candidate Components',
['Introducing new ones', 'Using existing ones', 'Promoting to a component'],
'Design Templates',
],
'Foundations',
'Components',
['Colors', 'Typography', 'Icons', 'Errors', 'Loading'],
'Candidate Components',
'Design Templates',
'Contributing',
['Introduction', 'Commits', 'Testing in the platforms', 'Release Process', 'Maintainers'],
],
},
},

controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
}

export default preview
7 changes: 7 additions & 0 deletions docs/About/Changelog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Markdown } from "@storybook/blocks"

import changelog from '../../CHANGELOG.md?raw'

# CHANGELOG

<Markdown>{changelog}</Markdown>
6 changes: 6 additions & 0 deletions docs/About/FAQ.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# FAQ

### What should I do if I can't implement my design specs using Antd atoms?

Please ask questions about it in the #aquarium channel. Ideally have a branch with your work in progress and some Storybook
stories so that we can see what you're trying to do.
20 changes: 20 additions & 0 deletions docs/About/Introduction.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Introduction

This is where all component related documentation will live at mParticle. This is mainly a work in progress at this point
and we are actively working on it.

## How to read this

TBD

## Glossary

| Term | Meaning |
| -------- | ------- |
| Component Candidate | TBD |
| Template | TBD |
| Eames | TBD |
| Aquarium | TBD |
| Antd | TBD |

---
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const DEFAULTS = {
month: 'short',
day: 'numeric',
year: 'numeric',
} as const

export interface IDateRangeStringProps {
start: Date
end: Date
formatOptions?: Intl.DateTimeFormatOptions
}

export const DateRangeString = ({ start, end, formatOptions = DEFAULTS }: IDateRangeStringProps) => (
<>
{new Intl.DateTimeFormat('en-US', {
...formatOptions,
}).formatRange(start, end)}
</>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Meta, Story } from '@storybook/blocks';

import * as SelectWithRangePickerStories from './SelectWithRangePicker.stories';

<Meta of={SelectWithRangePickerStories} />

# Date Range Filter

**Overview**

The Date Range Filter is used when a user needs to narrow down the dataset they are working with to a specific date
and/or time window, allowing users to focus on data relevant to the selected timeframe.

**Key Components**

The Date Range Filter consists of two main components:

- [Select Component](?path=/docs/components-data-entry-select--documentation)
- [Range Picker](https://ant.design/components/date-picker#date-picker-demo-range-picker)

**mParticle Usage**

The Date Range Filter can be used in dashboards, reports, or any interfaces where users interact with time-based data.

<Story of={SelectWithRangePickerStories.DateRangeFilter} />

<br />

## Current usages

**9/25/2024 - Observability Project in CDP**

<ul>
<li>
<div style={{ display: 'flex', alignItems: 'center' }}>
<img src="https://badgen.net/badge/icon/Figma?icon=libraries&label&color=purple" alt="Repo" style={{ marginRight: 8 }}/>
<a href="https://www.figma.com/design/hDSxMHoLlMlLeYbgvT3A6d/Observability-Exploration?node-id=2733-147740&node-type=canvas&t=WfJOqsHGC3JStCh3-0" target="_top" rel="nofollow" className="sbdocs sbdocs-a">Specs</a>
</div>
</li>
<li>
<div style={{ display: 'flex', alignItems: 'center' }}>
<img src="https://badgen.net/badge/icon/GitHub?icon=github&label" alt="Repo" style={{ marginRight: 8 }}/>
<a href="https://git.corp.mparticle.com/mParticle/mPServer/blob/main/src/UI/MP.UI.Web.Nancy/Assets/private/aurelia/src/viewmodels/observability/trace/components/SelectWithRangePicker/SelectWithRangePicker.tsx" target="_top" rel="nofollow" className="sbdocs sbdocs-a">mPServer Example</a>
</div>
</li>
</ul>

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react'
import type { Meta, StoryObj } from '@storybook/react'
import { SelectWithRangePicker as Component } from './SelectWithRangePicker'
import { fn } from '@storybook/test'
import { useArgs } from '@storybook/preview-api'

const meta: Meta<typeof Component> = {
title: 'Candidate Components/Directory/Date Range Filter',
component: Component,
}
export default meta

type Story = StoryObj<typeof Component>

export const DateRangeFilter: Story = {
args: {
value: 'last30days',
onSelect: fn(),
options: [
{
value: 'last24hours',
label: 'Last 24 hours',
},
{
value: 'last7days',
label: 'Last 7 days',
},
{
value: 'last30days',
label: 'Last 30 days',
},
],
},
render: function Render(args) {
const [{ value }, updateArgs] = useArgs()
return (
<Component
{...args}
value={value}
onChange={value => {
updateArgs({ value })
}}
/>
)
},
}
Loading

0 comments on commit 5ca1195

Please sign in to comment.