Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mdjs-layout #4

Merged
merged 7 commits into from
Feb 3, 2022
Merged
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
9 changes: 4 additions & 5 deletions border-radius/doc/doc.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
```js script
import '@divriots/dockit-core/sass-showcases';
import { html } from '~/md-layout';
import '@divriots/dockit-core/css-showcases';
```

# Border Radius

## border-radius

```html:html
<dockit-sass-showcases
```html story
<dockit-css-showcases
css-props-prefix="--border-radius"
component-class="box"
style-key="border-radius"
checkered-background="false"
></dockit-sass-showcases>
></dockit-css-showcases>
```
42 changes: 15 additions & 27 deletions button/doc/button.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
```js script
import 'https://gitcdn.link/repo/PrismJS/prism-themes/master/themes/prism-vsc-dark-plus.css';
import Button from '../src/Button.vue';
import * as stories from '../stories/button.stories.js';
import '~/md-layout';
```

# Button
Expand All @@ -13,38 +10,29 @@ This is a very simple example of a button

### Specifying a name

```jsx
<Button name="Dave"></Button>
```

Results in

```js story
export const named = stories.named;
```js preview-story
export const named = () => ({
components: { Button },
template: `<Button name='Dave' />`,
});
```

### Without a name

```jsx
<Button></Button>
```

Results in

```js story
export const anonymous = stories.anonymous;
```js preview-story
export const anonymous = () => ({
components: { Button },
template: `<Button />`,
});
```

## Variants

### Outlined

```jsx
<Button outlined></Button>
```

Results in

```js story
export const outlined = stories.outlined;
```js preview-story
export const outlined = () => ({
components: { Button },
template: `<Button outlined />`,
});
```
21 changes: 0 additions & 21 deletions button/stories/button.stories.js

This file was deleted.

15 changes: 7 additions & 8 deletions colors/doc/colors.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
```js script
import '@divriots/dockit-core/sass-showcases';
import { html } from '~/md-layout';
import '@divriots/dockit-core/css-showcases';
```

# Colors

## background-color

```html:html
<dockit-sass-showcases
```html story
<dockit-css-showcases
css-props-prefix="--color"
component-class="box"
style-key="background-color"
></dockit-sass-showcases>
></dockit-css-showcases>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since I fixed dockit-css-showcases to properly show opacity in the documentation context, it became clear that one of the colors you have is transparent... not sure if you meant that or created such color by mistake, please double check

image

```

## color

```html:html
<dockit-sass-showcases
```html story
<dockit-css-showcases
css-props-prefix="--color"
component-type="text"
style-key="color"
></dockit-sass-showcases>
></dockit-css-showcases>
```
27 changes: 27 additions & 0 deletions doc-layout/src/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions doc-layout/src/template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import '@divriots/dockit-core/style.css';
import '@divriots/dockit-core/mdjs-layout/define.js';
import { styles } from '@divriots/dockit-core/mdjs-layout';
import { html } from 'lit';
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import logoSvg from './logo.svg?raw';
import '~/theme/src/theme.scss';

export const docLayoutTemplate = (content, context) => html`
<style>
${unsafeHTML(styles)} .preview-story .story_padded {
background-color: var(--doc-color-background);
}
.box {
width: 4rem;
height: 4rem;
background-color: var(--color-white);
box-shadow: var(--shadow-large);
border-radius: var(--border-radius-medium);
}
</style>
<mdjs-layout
.context="${context}"
@color-scheme-change="${(event) => {
if (event.detail.colorScheme === 'dark') {
document.documentElement.classList.add('dark');
document.documentElement.setAttribute('color-scheme', 'dark');
} else {
document.documentElement.classList.remove('dark');
document.documentElement.setAttribute('color-scheme', 'light');
}
}}"
>
<div class="logo" slot="logo" aria-label="starter-vue3">
${unsafeHTML(logoSvg)}
</div>
<div class="prose dark:prose-invert">${unsafeHTML(content)}</div>
</mdjs-layout>
`;
9 changes: 4 additions & 5 deletions elevation/doc/doc.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
```js script
import '@divriots/dockit-core/sass-showcases';
import { html } from '~/md-layout';
import '@divriots/dockit-core/css-showcases';
```

# Elevation

## box-shadow

```html:html
<dockit-sass-showcases
```html story
<dockit-css-showcases
css-props-prefix="--shadow"
component-class="box"
style-key="box-shadow"
checkered-background="false"
></dockit-sass-showcases>
></dockit-css-showcases>
Copy link
Contributor Author

@bashmish bashmish Jan 31, 2022

Choose a reason for hiding this comment

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

elevation is not visible in the dark mode

one might think it's because of mdjs-layout typography which has too dark background which is not compatible with the DS (and doesn't set var(--doc-color-background) on the body) , but I think the shadows themselves are not dark compatible, so I'd recommend to consider adding 2 sets of shadows for light and dark separately

if you feel like it's because of mdjs-layout or how I set it up, we should discuss it
I have a well-thought vision here and prefer to have it discussed thoroughly before changing to smth different, the devil is in the details here

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I agree on having two different set of shadows for light/dark modes. Thanks 👍

```
23 changes: 8 additions & 15 deletions introduction/doc/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
```js script
import { html } from '~/md-layout';
```

<vue-logo></vue-logo>
<nuxt-logo></nuxt-logo>

# Vue.js v3.x Tech Sample

This is a simple Vue.js-based Design System sample.
Expand Down Expand Up @@ -46,32 +39,32 @@ Get the command to link your Design System in your local project. To so, click t
Your browser will open the URL given by the command. You'll see the default NuxtJS starting page.
3. Open your project in your IDE, and go to the file `~/app.vue`
4. Add a `<script>` tag, add the following lines to import the Design System `Button` component
```vue
```html
<script setup lang="ts">
import Button from '@backlight-dev/john.design-system/button/src/Button.vue';
import MyButton from '@backlight-dev/john.design-system/button/src/Button.vue';
</script>
```
5. Add a `<style>` tag to import the Design System Sass primitives at `app` level
```vue
```html
<style lang="scss">
@use '@backlight-dev/john.design-system/theme/src/theme.scss';
@use '@backlight-dev/john.design-system/theme/src/theme.scss';
</style>
```
6. Finally, replace the `app.vue`'s `<template>` tag content with a `Button` component instance. Your final `app.vue` file will look like:

```vue
```html
<template>
<div>
<Button outlined name="Rioters 🤘" />
<MyButton outlined name="Rioters 🤘" />
Copy link
Contributor Author

@bashmish bashmish Jan 31, 2022

Choose a reason for hiding this comment

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

I had to change vue lang to html to make sure the code highlighting is working. But this activates prettier which doesn't like capital letters in native tags, which was introduced to rewrite e.g. <BUTTON> to <button>, but the same happens to <Button> -> <button> which is undesired. So I renamed the tag to <MyButton> to workaround this behavior. Maybe best to introduce a prefix for all components in the DS so that all component names do not overlap with native HTML tags? Up to you what's the best fix here.

</div>
</template>

<script setup lang="ts">
import Button from '@backlight-dev/john.design-system/button/src/Button.vue';
import MyButton from '@backlight-dev/john.design-system/button/src/Button.vue';
</script>

<style lang="scss">
@use '@backlight-dev/john.design-system/theme/src/theme.scss';
@use '@backlight-dev/john.design-system/theme/src/theme.scss';
</style>
```

Expand Down
1 change: 0 additions & 1 deletion md-layout/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions md-layout/src/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions md-layout/src/md-layout.css

This file was deleted.

4 changes: 0 additions & 4 deletions md-layout/src/nuxt.svg

This file was deleted.

19 changes: 0 additions & 19 deletions md-layout/src/nuxt.svg.js

This file was deleted.

1 change: 0 additions & 1 deletion md-layout/src/vue.svg

This file was deleted.

19 changes: 0 additions & 19 deletions md-layout/src/vue.svg.js

This file was deleted.

5 changes: 5 additions & 0 deletions mdjs.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { docLayoutTemplate } from './doc-layout/src/template';

export default {
layout: docLayoutTemplate,
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"vue": "^3.1.4"
},
"devDependencies": {
"@divriots/dockit-core": "^0.1.9",
"@divriots/dockit-core": "^0.6.4",
"lit": "^2.0.2",
"prettier": "^2.3.2"
}
}
}
7 changes: 3 additions & 4 deletions spacing/doc/doc.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
```js script
import '@divriots/dockit-core/sass-showcases';
import { html } from '~/md-layout';
import '@divriots/dockit-core/css-showcases';
```

# Spacing

## spaces

```html:html
<dockit-sass-showcases css-props-prefix="--spacing"></dockit-sass-showcases>
```html story
<dockit-css-showcases css-props-prefix="--spacing"></dockit-css-showcases>
```
Loading