6. Using the Responsive theme default components / 使用Responsive主題的默認插件

6.1 Introduction / 簡介

在Shopware 5的Responsive主題中锌雀,我們?yōu)橛脩糸_發(fā)簡單的模板或者插件 提供了大量的可重復(fù)使用的組件(components)订框。利用這些默認插件衫樊,用戶可以通過一些簡單的HTML代碼創(chuàng)建按鈕(button)刷袍,面板(panel),警示信息(alert messages)以及其他一些UI元素迅办。你可以將這些代碼片段寫在你的*.tpl文件中蛔添。
為了幫助用戶更好的認出這些模板組件(template components),我們實施了一種parent-child的命名方式姻报。比如說:panel類作為父類己英,所有與他相關(guān)的子類都加上前綴panel--比如panel--title或者panel--body。如果你對Bootstrap之類的框架非常熟悉的話吴旋,你就會發(fā)現(xiàn)Shopware的組件甚至更佳簡單损肛。本文將會對較為重要的一些組件進行介紹。如果你想要了解更多關(guān)于Shopware的UI組件荣瑟,請點擊這里

6.2 Quick examples / 簡單舉例

6.2.1 Buttons / 按鈕
舉例:創(chuàng)建一個帶有不同樣式的按鈕

<a class="btn">Button</a>
<a class="btn is--primary">Primary Button</a>
<a class="btn is--secondary">Secondary Button</a>

更多的可選樣式如下:

is--large: larger button height               高度更大
is--small: smaller button height              高度更小
is--full: button with 100% width              寬度為100%
is--center: button with centered text         按鈕字體居中
is--icon-left: button with icon on the left   圖標放在按鈕左邊
is--icon-right: button with icon on the right 圖標放在按鈕右邊```
\* 該組件也可以被用在HTML的`<button>`元素中


**6.2.2 Panels / 面板**
舉例:創(chuàng)建兩個不同樣式的面板:

<div class="panel has--border is--rounded">
<div class="panel--title is--underline">
Panel Title
</div>

<div class="panel--body is--wide">
    Panel Content
</div>

</div>```
更多的可選樣式如下:

has--border: Panel with border          帶邊框
is--rounded: Panel with rounded corners 圓角```

**6.2.3 Icons / 圖標**
舉例:創(chuàng)建網(wǎng)頁字體圖標(webfont icon)

<i class="icon--basket"></i>```
就像之前說到過的那樣治拿,Shopware的Responsive主題提供了許多網(wǎng)頁字體圖標

用戶可以同時在button中使用icon笆焰,如下:

<a class="btn is--primary is--icon-left">
    <i class="icon--account"></i> Primary button with icon on the left
</a>```


**6.2.4 Alert messages / 警告窗口**
舉例:創(chuàng)建帶樣式的警示窗口(alert message box)

<div class="alert is--success is--rounded">
<div class="alert--icon">

<i class="icon--element icon--check"></i>
</div>
<div class="alert--content">
Alert message text
</div>
</div>```

更多的可選樣式如下:

is--success: Success message (green)  提示成功(綠色)
is--error: Error message (red)        提示出錯(紅色)
is--info: Info message (blue)         顯示信息(藍色)
is--warning: Warning message (yellow) 提示警告(黃色)``` 
\* 小記:為了外觀的統(tǒng)一劫谅,通常這四種里面必選一種

**6.2.5 Modal boxes / 盒子模型**
創(chuàng)建一個`position:absolute`且位于中心的盒子模型(absolute and centered)。

<div class="js--modal sizing--content" style="width: 600px; height: auto; display: block; opacity: 1;">
<div class="header">
<div class="title">
Modal box title
</div>
</div>
<div class="content">
Modal box content
</div>

<div class="btn icon--cross is--small btn--grey modal--close">
</div>
</div>```
* 小記:這些內(nèi)聯(lián)樣式是由jQuery插件生成的(jquery.modal.js)

6.2.6 Product boxes / 產(chǎn)品盒子
產(chǎn)品列表創(chuàng)建一個產(chǎn)品盒子(Product box)

<div class="product--box box--basic">
    <div class="box--content is--rounded">
        <div class="product--info">
            <a href="#" class="product--image">
                <!-- Article images -->
            </a>

            <div class="product--rating-container">
                <!-- Product rating stars -->
            </div>

            <a href="#" class="product--title" title="">
                Product title
            </a>

            <div class="product--description">
                Product description
            </div>

            <div class="product--price-info">
                <div class="price--unit">
                    <!-- Optional unit price -->
                </div>
                <div class="product--price">
                    <span class="price--default is--nowrap">
                        35,00 €
                    </span>
                </div>
            </div>

            <div class="product--actions">
                <!-- Product action links e.g. product compare -->
            </div>
        </div>
    </div>
</div>```
產(chǎn)品盒子的類型有:

box--basic: Default product box 默認的產(chǎn)品盒子
box--big-image: Product box with focus on a larger image 專為大圖片設(shè)計的產(chǎn)品盒子
box--minimal: Smaller product box with less information 信息較少的小產(chǎn)品盒子


**6.2.7 Product sliders / 產(chǎn)品滑動容器**
創(chuàng)建一個包含多個product-boxes嚷掠,且可以通過方向箭頭滑動的容器捏检。

<div class="product-slider" data-product-slider="true">

<!-- Product slider direction arrows -->
<a class="product-slider--arrow arrow--next is--horizontal"></a>
<a class="product-slider--arrow arrow--prev is--horizontal"></a>

<div class="product-slider--container is--horizontal">
    <div class="product-slider--item">
        <!-- Include of the product box -->
    </div>
</div>

</div>產(chǎn)品滑動框(帶有product-slider--containerproduct-slider--arrow```的<div>)可以是橫向或者是縱向:

is--horizontal: Horizontal slider alignment  橫向
is--vertical: Vertical slider alignment      縱向```

> 注意:實際上實現(xiàn)滑動效果的是來自jQuery插件,用的屬性叫做`data-product-slider="true"`不皆,如果想要做更深層次的改變贯城,比如想改變動畫速度,請詳細看```jquery.product-slider.js```(位于 Responsive/frontend/_public/src/js/)的介紹霹娄。

##6.3 Complete component overview / 所有組件概覽
你可以在shopware的官網(wǎng)上找到[所有組件的介紹](https://developers.shopware.com/styletile/)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末能犯,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子犬耻,更是在濱河造成了極大的恐慌踩晶,老刑警劉巖,帶你破解...
    沈念sama閱讀 222,104評論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件香追,死亡現(xiàn)場離奇詭異合瓢,居然都是意外死亡,警方通過查閱死者的電腦和手機透典,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,816評論 3 399
  • 文/潘曉璐 我一進店門晴楔,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人峭咒,你說我怎么就攤上這事税弃。” “怎么了凑队?”我有些...
    開封第一講書人閱讀 168,697評論 0 360
  • 文/不壞的土叔 我叫張陵则果,是天一觀的道長幔翰。 經(jīng)常有香客問我,道長西壮,這世上最難降的妖魔是什么遗增? 我笑而不...
    開封第一講書人閱讀 59,836評論 1 298
  • 正文 為了忘掉前任,我火速辦了婚禮款青,結(jié)果婚禮上做修,老公的妹妹穿的比我還像新娘。我一直安慰自己抡草,他們只是感情好饰及,可當我...
    茶點故事閱讀 68,851評論 6 397
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著康震,像睡著了一般燎含。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上腿短,一...
    開封第一講書人閱讀 52,441評論 1 310
  • 那天屏箍,我揣著相機與錄音,去河邊找鬼答姥。 笑死铣除,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的鹦付。 我是一名探鬼主播,決...
    沈念sama閱讀 40,992評論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼择卦,長吁一口氣:“原來是場噩夢啊……” “哼敲长!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起秉继,我...
    開封第一講書人閱讀 39,899評論 0 276
  • 序言:老撾萬榮一對情侶失蹤祈噪,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后尚辑,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體辑鲤,經(jīng)...
    沈念sama閱讀 46,457評論 1 318
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 38,529評論 3 341
  • 正文 我和宋清朗相戀三年杠茬,在試婚紗的時候發(fā)現(xiàn)自己被綠了月褥。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 40,664評論 1 352
  • 序言:一個原本活蹦亂跳的男人離奇死亡瓢喉,死狀恐怖宁赤,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情栓票,我是刑警寧澤决左,帶...
    沈念sama閱讀 36,346評論 5 350
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響佛猛,放射性物質(zhì)發(fā)生泄漏惑芭。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 42,025評論 3 334
  • 文/蒙蒙 一继找、第九天 我趴在偏房一處隱蔽的房頂上張望遂跟。 院中可真熱鬧,春花似錦码荔、人聲如沸漩勤。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,511評論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽越败。三九已至,卻和暖如春硼瓣,著一層夾襖步出監(jiān)牢的瞬間究飞,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,611評論 1 272
  • 我被黑心中介騙來泰國打工堂鲤, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留亿傅,地道東北人。 一個月前我還...
    沈念sama閱讀 49,081評論 3 377
  • 正文 我出身青樓瘟栖,卻偏偏與公主長得像葵擎,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子半哟,可洞房花燭夜當晚...
    茶點故事閱讀 45,675評論 2 359

推薦閱讀更多精彩內(nèi)容