Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
fix: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKienle committed Jul 25, 2019
1 parent 3f1195a commit cc72748
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 120 deletions.
File renamed without changes.
24 changes: 0 additions & 24 deletions src/components/Layout/Col.vue

This file was deleted.

24 changes: 0 additions & 24 deletions src/components/Layout/Section.vue

This file was deleted.

35 changes: 0 additions & 35 deletions src/components/Layout/Ui.vue

This file was deleted.

26 changes: 3 additions & 23 deletions src/components/Layout/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import Container from "./Container.vue";
import Col from "./Col.vue";
import Section from "./Section.vue";
import Ui from "./Ui.vue";
import App from "./App/_app.vue";
import App from "./App/app.vue";
import AppMain from "./App/app-main.vue";
import AppNavigation from "./App/app-navigation.vue";
import Shell from "./Shell/_shell.vue";
import Shell from "./Shell/shell.vue";
import ShellHeader from "./Shell/shell-header.vue";
import ShellApp from "./Shell/shell-app.vue";
import ShellFooter from "./Shell/shell-footer.vue";
import * as ShellBar from "./ShellBar";
import { pluginify, objectValues } from "./../../util";

export default pluginify(
Container,
Col,
Section,
Ui,
App,
AppMain,
AppNavigation,
Expand All @@ -27,16 +19,4 @@ export default pluginify(
...objectValues(ShellBar)
);

export {
Container,
Col,
Section,
Ui,
App,
AppMain,
AppNavigation,
Shell,
ShellHeader,
ShellFooter,
ShellApp
};
export { App, AppMain, AppNavigation, Shell, ShellHeader, ShellFooter, ShellApp };
35 changes: 35 additions & 0 deletions src/components/col/_col.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div class="fd-col" :class="classes">
<slot />
</div>
</template>

<script>
// Column-component – used together with `fd-container`.
export default {
name: "FdCol",
props: {
// Number of columns to span
span: {
type: Number,
// `null` – width is automatically computed
default: null
},
// Number of columns to shift the column
shiftBy: {
type: Number,
// `null` – no shifting
default: null
}
},
computed: {
classes() {
const { span, shiftBy } = this;
return [
span == null ? "" : `fd-col--${span}`,
shiftBy == null ? "" : `fd-col--shift-${shiftBy}`
];
}
}
};
</script>
4 changes: 4 additions & 0 deletions src/components/col/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FdCol from "./_col.vue";
import { pluginify } from "./../../util";
export default pluginify(FdCol);
export { default as Col } from "./_col.vue";
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<template>
<div :class="classes">
<div class="fd-container" :class="classes">
<!-- Content – or 0…12 instances of `fd-col` -->
<slot />
</div>
</template>

<script>
// Container component – should contains `fd-col`-instances.
export default {
name: "FdContainer",
props: {
// If `true`, the container will act as a flexbox.
flex: { type: Boolean, default: false },
fluid: { type: Boolean, default: false },
// If `true`, the wrapper is centered within it's parent.
centered: { type: Boolean, default: false }
},
computed: {
classes() {
return {
"fd-container": true,
"fd-container--flex": this.flex,
"fd-container--fluid": this.fluid,
"fd-container--centered": this.centered
Expand Down
4 changes: 4 additions & 0 deletions src/components/container/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FdContainer from "./_container.vue";
import { pluginify } from "./../../util";
export default pluginify(FdContainer);
export { default as Container } from "./_container.vue";
6 changes: 6 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Combobox from "./Combobox";
import ContextMenu from "./ContextMenu";
import ContextButton from "./ContextButton";
import ComboboxMenu from "./ComboboxMenu";
import Container from "./container";
import Col from "./col";
import Counter from "./Counter";
import DatePicker from "./DatePicker";
import DatePickerInput from "./DatePickerInput";
Expand All @@ -36,6 +38,7 @@ import ModalOverlay from "./ModalOverlay";
import Pagination from "./Pagination";
import Panel from "./Panel";
import Popover from "./Popover";
import Section from "./section";
import SearchInput from "./SearchInput";
import SideNav from "./SideNav";
import Spinner from "./Spinner";
Expand Down Expand Up @@ -68,6 +71,8 @@ const plugin = {
ButtonGroup,
Calendar,
Combobox,
Container,
Col,
ComboboxMenu,
Counter,
ContextMenu,
Expand Down Expand Up @@ -97,6 +102,7 @@ const plugin = {
Panel,
Popover,
SearchInput,
Section,
SideNav,
Spinner,
Status,
Expand Down
8 changes: 8 additions & 0 deletions src/components/section/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import FdSection from "./section.vue";
import FdSectionTitle from "./section-title.vue";
import FdSectionHeader from "./section-header.vue";
import { pluginify } from "./../../util";
export default pluginify(FdSection, FdSectionTitle, FdSectionHeader);
export { default as Section } from "./section.vue";
export { default as SectionTitle } from "./section-title.vue";
export { default as SectionHeader } from "./section-header.vue";
9 changes: 9 additions & 0 deletions src/components/section/section-header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<div class="fd-section__header"><slot /></div>
</template>

<script>
export default {
name: "FdSectionHeader"
};
</script>
15 changes: 15 additions & 0 deletions src/components/section/section-title.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script>
export default {
name: "FdSectionTitle",
props: {
tag: {
type: String,
default: "h3"
}
},
render(h) {
const tag = this.tag;
return h(tag, { class: "fd-section__title" }, [this.$slots.default]);
}
};
</script>
12 changes: 12 additions & 0 deletions src/components/section/section.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<template>
<section class="fd-section">
<slot name="header" />
<slot />
</section>
</template>

<script>
export default {
name: "FdSection"
};
</script>
7 changes: 7 additions & 0 deletions src/docs/content/en_us/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@ Layout containers used to arrange content on a 12-column grid. Can be used insid

## Fluid with Cols

This is a small playground which shows you how the fluid container behaves in different situations. Try adding/removing columns and the resize the window.

<d-example name="3-container-fluid-with-cols">
</d-example>

## Centered & Shifted Content

<d-example name="shifted-and-centered">
</d-example>
2 changes: 2 additions & 0 deletions src/docs/content/en_us/section.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
fdRelatedComponents:
- fd-section
- fd-section-header
- fd-section-title
- fd-panel
- fd-panel-grid
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<fd-container style="width: 200px;" centered>
<fd-container v-fd-bg:neutral-2 style="width: 200px;" centered>
Centered
</fd-container>
</div>
Expand Down
22 changes: 12 additions & 10 deletions src/docs/content/examples/container/3-container-fluid-with-cols.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
<template>
<div>
Columns:
<fd-button :disabled="addDiabled" @click="cols++" styling="light" icon="sys-add"></fd-button>
<fd-button
:disabled="removeDisabled"
@click="cols--"
styling="light"
icon="sys-minus"
></fd-button>
<fd-button :disabled="addDiabled" @click="cols++" styling="light" icon="sys-add">
Column
</fd-button>
<fd-button :disabled="removeDisabled" @click="cols--" styling="light" icon="sys-minus">
Column
</fd-button>
<hr />
<br />
<fd-container fluid>
<fd-col :span="1" v-for="col in cols" :key="`col-${col}`">{{ col }}. Column</fd-col>
<fd-col :span="span" v-for="col in cols" :key="`col-${col}`">{{ col }}. Column</fd-col>
</fd-container>
</div>
</template>

<script>
export default {
data() {
return { cols: 6 };
return { cols: 3 };
},
computed: {
span() {
return 12 / this.cols;
},
addDiabled() {
return this.cols > 11;
},
Expand Down
5 changes: 5 additions & 0 deletions src/docs/content/examples/container/shifted-and-centered.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<fd-container centered>
<fd-col :shift-by="2" :span="3" v-fd-bg:neutral-2>Content</fd-col>
</fd-container>
</template>
7 changes: 6 additions & 1 deletion src/docs/content/examples/section/header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<fd-section title="Section title">
<fd-section>
<template #header>
<fd-section-header>
<fd-section-title>Section title</fd-section-title>
</fd-section-header>
</template>
<fd-panel>Panel</fd-panel>
</fd-section>
</template>

0 comments on commit cc72748

Please sign in to comment.