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

Feature/update list #286

Merged
merged 25 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 0 additions & 11 deletions _src /atoms/list-item/ListItem.js

This file was deleted.

7 changes: 0 additions & 7 deletions _src /atoms/list-item/ListItem.scss

This file was deleted.

14 changes: 0 additions & 14 deletions _src /atoms/list/List.scss

This file was deleted.

6 changes: 0 additions & 6 deletions _src /atoms/list/List.selectors.json

This file was deleted.

79 changes: 0 additions & 79 deletions _src /atoms/list/List.stories.js

This file was deleted.

20 changes: 20 additions & 0 deletions src/atoms/list-item/ListItem.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.a-list-item {
@apply p-2;
}

.a-list-item--label {
float: left;
ofrankowska marked this conversation as resolved.
Show resolved Hide resolved

@apply clear-left;
@apply table-cell;
@apply pt-0 pr-2 pb-2 pl-0;
}

.a-list-item--label::after {
content: ":";
}

.a-list-item--value {
@apply table-cell;
@apply pt-0 pr-2 pb-2 pl-0;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<component
:is="tag"
:class="tagClassName"
class="a-list-item"
>
<!-- @slot Item content -->
<!-- @slot for list item content -->
<slot />
</component>
23 changes: 23 additions & 0 deletions src/atoms/list-item/ListItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
props: {
/**
* To use another tag instead of `li`
*/
tag: {
type: String,
default: 'li'
}
},
computed: {
tagClassName () {
switch (this.tag) {
case 'dt':
return 'a-list-item--label'
case 'dd':
return 'a-list-item--value'
default:
return ''
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import AListItem from './ListItem.js'

export default {
name: 'AlpacaListItem',

mixins: [AListItem]
}
</script>

<style lang="scss" src="./ListItem.scss" />
<style src="./ListItem.css" />
42 changes: 42 additions & 0 deletions src/atoms/list/List.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.a-list {
@apply m-0 p-0;
@apply list-none;
@apply text-primary;
szafran89 marked this conversation as resolved.
Show resolved Hide resolved
}

.a-list--horizontal {
@apply flex;
@apply flex-row flex-wrap;
}

@screen md {
.a-list--horizontal {
@apply flex-no-wrap;
}
}
ofrankowska marked this conversation as resolved.
Show resolved Hide resolved

.a-list--center {
@apply justify-center;
@apply text-center;
}

.a-list--native {
@apply list-disc;
}

.a-list--native.a-list--horizontal {
@apply list-none;
}
szafran89 marked this conversation as resolved.
Show resolved Hide resolved

.a-list--divided > * {
@apply border-solid border-dark;
@apply border-b border-r-0;
}

.a-list--divided.a-list--horizontal > * {
@apply border-r border-b-0;
}

.a-list--divided > *:last-child {
@apply border-0;
}
File renamed without changes.
2 changes: 1 addition & 1 deletion _src /atoms/list/List.js → src/atoms/list/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export default {
props: {
/**
* Tag
* To use another tag instead of `ul`
*/
tag: {
type: String,
Expand Down
18 changes: 18 additions & 0 deletions src/atoms/list/List.selectors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"name": ".a-list--horizontal",
"description": "Selector for applying horizontal styles"
},
{
"name": ".a-list--center",
"description": "Selector for applying center styles"
},
{
"name": ".a-list--native",
"description": "Selector for applying native styles"
},
{
"name": ".a-list--divided",
"description": "Selector for applying divided styles"
}
]
File renamed without changes.
74 changes: 74 additions & 0 deletions src/atoms/list/List.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { select, text } from '@storybook/addon-knobs'

import getClassKnobsConfig from '@utils/helpers/get-class-knobs-config.js'
import selectorsConfig from './List.selectors.json'

import AList from './List.vue'
import AListItem from '../list-item/ListItem.vue'

const classKnobsConfig = getClassKnobsConfig(selectorsConfig)

export default {
title: 'Atoms/List',
component: AList
}

export const Default = () => ({
components: { AList, AListItem },
props: {
classKnobs: {
default: select('BEM Modifier', classKnobsConfig)
ofrankowska marked this conversation as resolved.
Show resolved Hide resolved
}
},
template: `
<a-list :class="classKnobs">
<a-list-item>
Lorem ipsum
</a-list-item>
<a-list-item>
Lorem ipsum
</a-list-item>
<a-list-item>
Lorem ipsum
</a-list-item>
</a-list>
`
})

export const Description = () => ({
ofrankowska marked this conversation as resolved.
Show resolved Hide resolved
components: { AList, AListItem },
props: {
tagKnobs: {
default: text('Tag', 'dl')
}
},
ofrankowska marked this conversation as resolved.
Show resolved Hide resolved
template: `
<a-list :tag="tagKnobs">
<a-list-item tag="dt">
Lorem ipsum
</a-list-item>
<a-list-item tag="dd">
Lorem ipsum value
</a-list-item>
<a-list-item tag="dt">
Lorem ipsum
</a-list-item>
<a-list-item tag="dd">
Lorem ipsum value
</a-list-item>
</a-list>
`
})

export const WithSlots = () => ({
components: { AList, AListItem },
props: {
classKnobs: {
default: select('BEM Modifier', classKnobsConfig)
}
},
template: `
<a-list :class="classKnobs">
</a-list>
`
ofrankowska marked this conversation as resolved.
Show resolved Hide resolved
})
3 changes: 1 addition & 2 deletions _src /atoms/list/List.vue → src/atoms/list/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import AList from './List.js'

export default {
name: 'AlpacaList',

mixins: [AList]
}
</script>

<style lang="scss" src="./List.scss" />
<style src="./List.css" />