diff --git a/changelog/unreleased/accordion b/changelog/unreleased/accordion new file mode 100644 index 000000000..ccc044f6a --- /dev/null +++ b/changelog/unreleased/accordion @@ -0,0 +1,5 @@ +Change: New accordion component implementation + +We rewrote the accordion component to remove UIKit styles and align with our own styling. Some accessibility aspects are already implement, for example expanding and collapsing accordion items by pressing space or enter already works. More will come later on. + +https://github.com/owncloud/owncloud-design-system/pull/911 diff --git a/src/elements/OcAccordion.vue b/src/elements/OcAccordion.vue new file mode 100644 index 000000000..979729f62 --- /dev/null +++ b/src/elements/OcAccordion.vue @@ -0,0 +1,83 @@ + + + +An accordion is a vertically stacked set of interactive headings that each contain a title, content snippet, or thumbnail representing a section of content. +The headings function as controls that enable users to reveal or hide their associated sections of content. +Accordions are commonly used to reduce the need to scroll when presenting multiple sections of content on a single page. + +The accordion component is using `oc-accordion-item` as its children. +To see documentation on how to use this component, see [oc-accordion-item](/#/Elements/oc-accordion-item). + +```jsx + + +

+ I am the content of this accordion +

+
+ +

Enter some text!

+ +
+
+``` +
diff --git a/src/elements/OcAccordionItem.vue b/src/elements/OcAccordionItem.vue new file mode 100644 index 000000000..723870ebe --- /dev/null +++ b/src/elements/OcAccordionItem.vue @@ -0,0 +1,128 @@ + + diff --git a/src/elements/_OcAccordionItem.vue b/src/elements/_OcAccordionItem.vue deleted file mode 100644 index e99a5de31..000000000 --- a/src/elements/_OcAccordionItem.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - -```jsx - - -
- Public link share -
-
-

Hey, I can be expanded

-
-
-
-``` -
diff --git a/src/patterns/OcAccordion.vue b/src/patterns/OcAccordion.vue deleted file mode 100644 index 243d506bc..000000000 --- a/src/patterns/OcAccordion.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - -```jsx - - - -

- I am the content of this accordion -

-
- - - - - -
-``` -
diff --git a/src/styles/_owncloud.scss b/src/styles/_owncloud.scss index e72b98dad..ebb7c032a 100644 --- a/src/styles/_owncloud.scss +++ b/src/styles/_owncloud.scss @@ -7,10 +7,10 @@ @import '../../node_modules/uikit/src/scss/variables-theme'; @import '../../node_modules/uikit/src/scss/mixins-theme'; -// // 4. Import UIkit. +// 3. Import UIkit. @import '../../node_modules/uikit/src/scss/uikit-theme'; -// 3. Your custom mixin overwrites. +// 4. Your custom mixin overwrites. @import 'theme/helper'; @import 'theme/oc-spacing'; @import 'theme/background'; @@ -51,3 +51,4 @@ @import 'theme/oc-modal'; @import 'theme/oc-sidebar'; @import 'theme/oc-radio'; +@import 'theme/oc-accordion'; diff --git a/src/styles/theme/oc-accordion.scss b/src/styles/theme/oc-accordion.scss new file mode 100644 index 000000000..f70baa41e --- /dev/null +++ b/src/styles/theme/oc-accordion.scss @@ -0,0 +1,39 @@ +.oc-accordion { + list-style: none; + padding: 0; + + &-item + &-item { + margin-top: $space-medium; + } + + &-title { + @extend .oc-mb-rm; + + display: block; + font-size: $medium-font-size; + + > .oc-button, + > .oc-button:hover, + > .oc-button:focus { + color: $color; + outline: none; + text-decoration: none; + + .oc-icon { + transition-duration: 0.3s; + + &.rotate { + transform: rotate(180deg); + } + + > svg { + fill: $color; + } + } + } + } + + &-content { + margin-top: $space-small; + } +} diff --git a/src/tokens/font-size.yml b/src/tokens/font-size.yml index 8b3ffe933..d11c4cffd 100644 --- a/src/tokens/font-size.yml +++ b/src/tokens/font-size.yml @@ -7,7 +7,7 @@ props: small-font-size: value: "0.875rem" font-size: - value: "15px" + value: "1rem" medium-font-size: value: "1.25rem" large-font-size: