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 20 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
7 changes: 0 additions & 7 deletions _src /atoms/list-item/ListItem.html

This file was deleted.

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.

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

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.

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

.a-list-item--label {
@apply float-left clear-left;
@apply table-cell;
@apply pt-0 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;
}
7 changes: 7 additions & 0 deletions src/atoms/list-item/ListItem.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<component
:is="tag"
:class="getClass('list-item')"
>
<!-- @slot for list item content -->
<slot />
</component>
21 changes: 21 additions & 0 deletions src/atoms/list-item/ListItem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { alpacaUIMixin } from '../../../utils/helpers/alpaca-ui.js'

export default {
mixins: [alpacaUIMixin],
props: {
/**
* To use another tag instead of `li`
*/
tag: {
type: String,
default: 'li'
}
},
config: {
base: {
'list-item': [
'p-2'
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ describe('ListItem', () => {
const wrapper = mount(AListItem)

expect(wrapper.is('li')).toBe(true)
expect(wrapper.classes()).toContain('a-list-item')
expect(wrapper.classes().length).toBe(1)
})

it('renders slot text when passed', () => {
Expand All @@ -17,8 +15,8 @@ describe('ListItem', () => {
}
})

expect(wrapper.find('.a-list-item > span').exists()).toBe(true)
expect(wrapper.find('.a-list-item > span').text()).toEqual('List item default text')
expect(wrapper.find('span').exists()).toBe(true)
expect(wrapper.find('span').text()).toEqual('List item default text')
})

it('should be generated with the `dt` passed as tag', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import AListItem from './ListItem.js'

export default {
name: 'AlpacaListItem',

mixins: [AListItem]
}
</script>

<style lang="scss" src="./ListItem.scss" />
2 changes: 1 addition & 1 deletion _src /atoms/list/List.html → src/atoms/list/List.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component
:is="tag"
class="a-list"
:class="getClass('list')"
>
<!-- @slot List item -->
<slot />
Expand Down
49 changes: 49 additions & 0 deletions src/atoms/list/List.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { alpacaUIMixin } from '../../../utils/helpers/alpaca-ui.js'

export default {
mixins: [alpacaUIMixin],
props: {
/**
* To use another tag instead of `ul`
*/
tag: {
type: String,
default: 'ul'
}
},
config: {
base: {
list: [
'list-none',
'text-primary'
]
},
native: {
list: [
'list-disc'
]
},
horizontal: {
list: [
'flex', 'flex-row', 'flex-wrap'
]
},
centered: {
list: [
'justify-center',
'text-center'
]
},
divided: {
list: [
'divide-y', 'divide-dark'
]
},
'divided-horizontal': {
list: [
'flex', 'flex-row', 'flex-wrap',
'divide-x', 'divide-dark'
]
}
}
}
6 changes: 2 additions & 4 deletions _src /atoms/list/List.spec.js → src/atoms/list/List.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ describe('List', () => {
it('has default structure', () => {
const wrapper = mount(AList)

expect(wrapper.is('ul')).toBe(true)
expect(wrapper.classes()).toContain('a-list')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.element.tagName).toBe('UL')
})

it('renders slot text when passed', () => {
Expand All @@ -28,7 +26,7 @@ describe('List', () => {
}
})

expect(wrapper.is('ol')).toBe(true)
expect(wrapper.element.tagName).toBe('OL')
expect(wrapper.classes()).toContain('a-list')
expect(wrapper.props().tag).toBe('ol')
})
Expand Down
Loading